srinivas.siteApplied RoboticsUnit 19

Unit 19 · Flight in simulation · 100 min core; installation is additional and may exceed 100 min

One SITL path and telemetry

Mission: Make a virtual craft report fresh positions, then prepare a replayable setup and two launch records.

The interactive version of this unit needs JavaScript. Below are its steps as text.

Steps

1. Start the workstation

Select “Run the virtual craft”, then compare the workstation with its SIMULATED readout.

Why it matters: This browser simulation is a teaching model. Nothing here starts PX4.

2. Ask for a report

Select “Show one sample”, then compare the workstation with its SIMULATED readout.

Why it matters: A sample is one observation at a particular time. Between samples the displayed report is held.

3. Locate the craft

Select “Show the horizontal axes”, then compare the workstation with its SIMULATED readout.

Why it matters: A coordinate frame gives directions and an origin for a position.

4. Add height

Select “Show the down axis”, then compare the workstation with its SIMULATED readout.

Why it matters: In local NED, x is north, y east and z down. Here altitude relative to the toy origin is minus z.

5. Change the update rate

Select “Compare slow reports”, then compare the workstation with its SIMULATED readout.

Why it matters: The update rate is samples per second, measured in Hz. It changes observations, not this trajectory or a PX4 controller frequency.

6. Look between reports

Select “Show the held pose”, then compare the workstation with its SIMULATED readout.

Why it matters: This 0.5 Hz circle returns to the same sampled point at 0.5 Hz. That special aliasing example hides the intervening motion.

7. Read the clocks

Select “Show sample age”, then compare the workstation with its SIMULATED readout.

Why it matters: Sample age is display time minus acquisition time. An old report can be misleading even if the value looks plausible.

8. Check validity

Select “Show the evidence boundary”, then compare the workstation with its SIMULATED readout.

Why it matters: Freshness, presence and validity are different questions. A real topic can be absent or invalid even when a display exists.

9. Record the environment

Select “Show the setup card”, then compare the workstation with its SIMULATED readout.

Why it matters: A source tag and compatible simulator major version are a baseline. Record exact dependencies as well because the setup script does not freeze them bit for bit.

10. Capture the first run

Select “Show the first record”, then compare the workstation with its SIMULATED readout.

Why it matters: Capture actual local position and attitude output, timestamps and validity in the Ubuntu environment. Browser samples are not those outputs.

11. Repeat the run

Select “Show the comparison”, then compare the workstation with its SIMULATED readout.

Why it matters: Use the same setup and command, then compare settings and fresh valid data. Identical timestamps or positions are not required.

12. Prepare a replay

Select “Show the full workstation”, then compare the workstation with its SIMULATED readout.

Why it matters: Write the steps and retain the actual transcript. Your experiment remains pending until you perform and review it.

Go deeper

One exact setup path · separate installation time

Use an existing clean Ubuntu 22.04 x86_64 environment. PX4 v1.17.0 and Gazebo Harmonic (gz-sim8) are the chosen compatible baseline; exact package versions may vary. Before running the setup script, verify that git rev-parse HEAD equals d6f12ad1c4f70ad3230afd7d86e971421e02fef4, the release commit reviewed here. Stop if it differs. Inspect the script before execution; it can replace installed simulator packages. These commands modify the chosen clean Ubuntu environment, not macOS. Installation is required for the two-launch experiment unless already complete; its time is additional and may require a later session.

mkdir -p ~/px4-sitl-unit19
cd ~/px4-sitl-unit19
git clone --branch v1.17.0 --recursive https://github.com/PX4/PX4-Autopilot.git
cd PX4-Autopilot
git rev-parse HEAD
git submodule status --recursive
less Tools/setup/ubuntu.sh
bash Tools/setup/ubuntu.sh --no-nuttx

Restart the Ubuntu environment as the official setup guide directs. Stop and resume here if needed. From the PX4-Autopilot directory record git rev-parse HEAD and git submodule status --recursive; record OS and architecture, exact Gazebo packages and versions, compiler, Python and CMake versions, and a package manifest or environment snapshot if available. A tag and setup script do not guarantee a bit-for-bit dependency freeze.

Run the following from the PX4 source directory after restart. Review the package manifest before sharing it; it can reveal installed software.

git rev-parse HEAD
git submodule status --recursive
cat /etc/os-release
uname -m
dpkg-query -W "*gz-sim8*"
cc --version
python3 --version
cmake --version
dpkg-query -W > unit19-packages.txt
make px4_sitl gz_x500

Launch 1: retain a local terminal transcript, including the launch command and pxh help/status. At the pxh prompt request listener vehicle_local_position -n 5 and listener vehicle_attitude -n 5; capture actual output including timestamp fields, local NED frame, metres and validity flags where provided, and attitude quaternion/frame as defined by the schema. Check advancing timestamps with repeated observations. PX4 timestamps are microseconds since system start; the toy uses seconds. No ULog is implied by listener text or a screenshot.

For a local transcript, start script -f unit19-launch1.txt in the PX4 source directory, then run make px4_sitl gz_x500 inside that recorded shell. After shutdown and the simulator has exited, type exit to finish the transcript. Repeat as unit19-launch2.txt for the second launch; check that both files contain the actual output before comparing.

help
commander status
listener vehicle_local_position -n 5
listener vehicle_attitude -n 5
shutdown

The preceding commands are entered in pxh after launch, with shutdown used only when ready to stop. Repeat listener requests to inspect advancing timestamps. Stop with shutdown at the pxh prompt; exit any remaining simulator using its normal terminal or window, stopping only your own test processes. Launch 2 with the same command and environment, capture the same fields and compare intended settings, validity and fresh advancing timestamps. Replay your written steps. Absolute timestamps and positions need not be identical, and physics need not be deterministic.

Rate, frames and limits

age = display time − acquisition time
NED (north, east, down) → ENU (east, north, up): (x, y, z) → (y, x, −z)

The toy circle has radius 2 m, frequency 0.5 Hz, height 1 m above its local origin and duration 5 s. Samples are held, with no interpolation. Its fixed trajectory is illustrative, not a PX4 simulation or flight solver. From N recorded samples with first/last acquisition times, (N−1)/(last−first) estimates the average observed rate when last > first. Irregular gaps, listener limits and validity still matter; it is not the controller frequency and a screenshot alone is insufficient.

Video question: What is flying when no aircraft exists? A simulated vehicle and environment exchange software state with an autopilot; no physical craft flies. Unit 20 owns simulated missions and disturbances.