UAV Systems Engineering · M6-L8 · Hands-on lab (runs on your machine)
Implement a simple autonomous waypoint mission in simulation
Put the pieces together: a mission node that flies, monitors itself and ends safely.
What you will do
This lab is the core of Capstone 3. You will write the mission logic as a state machine on top of the offboard publisher from the previous labs and prove it worked from the log.
Before you start
- Labs “Send position and velocity commands” and “Analyze flight logs” completed.
- Lessons M5-T10 (waypoint navigation) and M6-T11 (offboard control).
Design
Use a small state machine with explicit entry conditions and timeouts:
| State | Action | Exit condition |
|---|---|---|
| STREAM | Publish setpoints at the current position | Stream running for 1 s |
| ARM | Send mode and arm commands | vehicle_status shows OFFBOARD and ARMED, or timeout 5 s → ABORT |
| TAKEOFF | Setpoint to mission altitude | Altitude within 0.3 m |
| LEG | Rate-limited setpoint toward waypoint | Within acceptance radius 0.5 m, or leg timeout → ABORT |
| RETURN | Setpoint toward start position at altitude | Within 0.5 m |
| LAND | Land command, stop streaming after touchdown | Disarmed |
| ABORT | Hold position, then land | Disarmed |
Steps
- Implement the state machine so the setpoint publisher runs on its own timer and the mission logic only updates the target.
- Fly a 4-waypoint mission with altitude changes and an acceptance radius of 0.5 m.
- Add a leg timeout and an abort path, and test it by commanding an unreachable waypoint.
- Log mission events (state changes with time) to a file and to the ROS 2 logger.
- From the ULog compute: time per leg, maximum tracking error, maximum speed and altitude.
Extension
- Add a battery threshold from
/fmu/out/battery_statusthat triggers RETURN. - Replace the rate-limited setpoint by a minimum-snap or MPC trajectory (lessons M5-T8, M5-T9).
- Make the node publish a health record that a supervisor could use (lesson M2-T16).
How to know it worked
- The vehicle flies all waypoints, returns and lands autonomously in SITL.
- The abort path triggers and ends safely when a leg is unreachable.
- Log-derived statistics are reported per leg.
If it does not work
| Symptom | Likely cause | What to check |
|---|---|---|
| Vehicle overshoots waypoints | Setpoint steps too large or acceptance radius too small | Rate-limit the setpoint; widen the radius slightly |
| Mission stalls | Acceptance never satisfied due to offset or NED sign error | Print the distance to the target each second |
| Drops out of offboard mid-mission | Publisher stalled by mission logic | Keep the publisher on its own timer |
References
Record your progress
Saved in this browser. This lab runs on your own machine, so the site cannot check it for you.