srinivas.siteApplied RoboticsUnit 20

Unit 20 · Flight in simulation

Simulated missions and disturbances

Mission: Take off, reach a waypoint and land despite a side push; compare repeated trials.

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

Steps

1. Lift off

Press “Lift off” and watch the craft rise.

Why it matters: The target describes where the craft should be. The response is where this toy puts it.

2. Reach the waypoint

Press “Travel” and watch the target move right.

Why it matters: A mission specifies desired actions in order. The waypoint is a desired place on that route.

3. Return and land

Press “Land” and watch the return and descent.

Why it matters: The same craft carries the takeoff, waypoint and landing sequence. A response can lag a changing target.

4. Compare the paths

Press “Trace” to draw the route so far.

Why it matters: Their separation changes with time. The comparison uses the same reference for both paths.

5. Recall the route

Press “Repeat” to replay the same route.

Why it matters: The mission is held fixed so a later change has a meaningful comparison. This is a deterministic toy.

6. Add a side push

Press “Push” and watch the arrow during the route.

Why it matters: The chosen horizontal acceleration is a disturbance, not a wind speed or a drag calculation. It pushes the response away from the target.

7. Measure separation

Press “Measure” and watch the error change.

Why it matters: Position error here is the two-dimensional distance between target and response. The maximum so far cannot reveal a future value.

8. See an observation

Press “Observe” and compare the marker with the craft.

Why it matters: This synthetic observation is deliberately identical to the toy response. A real estimate can differ from physical truth.

9. Recall the evidence

Press “Replay evidence” and follow the three labels.

Why it matters: A command is desired motion. An estimate is an observation-derived position, while response is the simulated vehicle motion.

10. Check the mission

Press “Check route” and watch through the deadline.

Why it matters: Completion requires reaching within 0.6 m of the waypoint during the hold and landing within 0.5 m of the start by 30 s. The landing height must be at most 0.05 m and vertical speed at most 0.15 m/s.

11. Repeat a condition

Press “Repeat trials” to see three deterministic toy trials.

Why it matters: Small labelled variations make the simulated trials distinct. Repeating deterministic calculations is not empirical evidence.

12. Compare and investigate

Press “Compare” to see calm and strong toy trials.

Why it matters: Compare completion and maximum error before suggesting a cause. Unrealistic wind assumptions or an altitude-frame mismatch can invalidate an interpretation.

Go deeper

Actual experiment: software-in-the-loop (SITL)

Allow at least another 100 min plus setup. Begin with the reviewed Unit 19 Ubuntu 22.04 x86_64 environment, PX4 v1.17.0 at d6f12ad1c4f70ad3230afd7d86e971421e02fef4, Gazebo Harmonic / gz-sim8 and x500. These Ubuntu instructions are not native Mac commands; defer if the setup is absent. Record the exact QGroundControl Stable V5.0 build, submodules and packages. Telemetry means data reported by the simulated vehicle; the browser toy does not connect to PX4.

In QGroundControl Plan, add takeoff, one waypoint and land; use about 10 m horizontal and 5 m relative-to-launch altitude. Check the altitude frame against above mean sea level (AMSL) and north-east-down (NED), then Save As, Upload, Fly and Start Mission. Confirm only a simulated link and no physical aircraft connected before arming the virtual vehicle. Stop on readiness or failsafe errors; never bypass safety checks.

Set the two wind conditions in the same world

In your learner-owned PX4 checkout, open Tools/simulation/gz/worlds/windy.sdf in a text editor. Within the world wind element, change only linear_velocity: use 0 0 0 for calm and 2 0 0 for wind. The vector is m/s in world ENU: the second condition is 2 m/s east. The original windy file is not calm: it contains 5 2 0. Keep the world name windy, vehicle, mission and all other settings identical. Save a copy and SHA-256 of the exact world used with each condition record; retain the Git diff showing only the vector change.

git -C Tools/simulation/gz rev-parse HEAD
git -C Tools/simulation/gz diff -- worlds/windy.sdf
sha256sum Tools/simulation/gz/worlds/windy.sdf
make px4_sitl gz_x500_windy

Use the Unit 19 release and its gz submodule b6127f4ec20de867e215fb5f78ae88b80f371909. Before every trial, stop your previous PX4/Gazebo test normally, then start a fresh windy world with the command above; an already-running world may ignore a changed launch environment. Confirm the loaded world and model in startup output and inspect the simulator wind configuration/state for the selected vector. Retain that evidence. If you cannot confirm the selected wind was loaded/applied, record the wind condition as unverified; the filename or a changed browser label is insufficient.

Create one saved QGroundControl plan on flat simulated ground: takeoff to 5 m relative to launch, one waypoint about 10 m away at that altitude, then a land item. Set and record the flight speed, exact waypoint coordinates, actual home position, acceptance settings and a 120 s deadline from mission start. Keep the same plan, controller, parameters and deadline for all six trials. A missing prerequisite or failed readiness check is a stopping point, not a reason to bypass checks.

Collect calm trials 1–3 and wind trials 1–3, restarting the same world/model for each, confirming only the virtual link before Start Mission. Record observed mission-finished and landed/disarmed status or timeout/failsafe separately. After landing and log closure, stop with shutdown in pxh and close your remaining simulator normally. Save the actual ULog for each run with its condition, trial ID, times, world/plan/parameter hashes and status. In QGroundControl use Analyze → Log Download, Refresh, select the closed log and Download; verify the saved .ulg exists and is readable. No cloud upload is required.

Use an existing local ULog tool such as PX4 pyulog to inspect/export vehicle_local_position and trajectory_setpoint; record its exact version and settings. The release logger requests these topics, but inspect your actual log before analysis. Declare the mission-start-to-land/timeout window and a maximum prior-setpoint gap of 0.5 s. Match each valid position sample to the most recent setpoint at or before its timestamp; exclude older, missing, nonfinite or invalid data. Retain sample counts, exclusions, coverage and gaps. Missing coverage of a phase means the reported maximum is incomplete, not a complete mission bound.

For each ULog compare finite, valid vehicle_local_position estimates with the nearest prior trajectory_setpoint in the same NED origin and metres, using each topic’s timestamp publication field in µs, within a declared maximum gap and time window. Reject missing or NaN components. Never subtract relative altitude directly from NED z or AMSL, or compare unsynchronised rows.

3D tracking error = √((xsp − xest)² + (ysp − yest)² + (zsp − zest)²)

Report the maximum of valid sampled errors in m, sample count and gaps. This is setpoint tracking against an estimate, not true GPS accuracy or a mission waypoint tolerance; a sampled maximum does not bound intersample error. Completion comes from mission and landed status, not low error. Missing topics or logs block evidence, never declare a pass.

Toy model limits

The browser uses a deterministic 2D side view, not PX4 or an aerodynamic flight solver. Its vertical controller already compensates gravity; wind is an imposed horizontal acceleration, not wind speed or a drag formula. Its 2D target-to-response norm differs from the real experiment’s 3D setpoint-to-estimate error. The selected nominal push is multiplied by 0.96, 1 and 1.04 in trials 1, 2 and 3. The readout shows the actual push at the current time. Three deterministic variations are not empirical evidence.

Public video question: How does simulated wind change the mission?