Skip to the content
FixTheRobot Explore Robotics / UAV / Module 6 / M6-L8

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.

  • UAV Software and Flight-Controller Integration
  • Implementation-specific
  • About 120 minutes

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:

Mission state machine
StateActionExit condition
STREAMPublish setpoints at the current positionStream running for 1 s
ARMSend mode and arm commandsvehicle_status shows OFFBOARD and ARMED, or timeout 5 s → ABORT
TAKEOFFSetpoint to mission altitudeAltitude within 0.3 m
LEG kkRate-limited setpoint toward waypoint kkWithin acceptance radius 0.5 m, or leg timeout → ABORT
RETURNSetpoint toward start position at altitudeWithin 0.5 m
LANDLand command, stop streaming after touchdownDisarmed
ABORTHold position, then landDisarmed

Steps

  1. Implement the state machine so the setpoint publisher runs on its own timer and the mission logic only updates the target.
  2. Fly a 4-waypoint mission with altitude changes and an acceptance radius of 0.5 m.
  3. Add a leg timeout and an abort path, and test it by commanding an unreachable waypoint.
  4. Log mission events (state changes with time) to a file and to the ROS 2 logger.
  5. From the ULog compute: time per leg, maximum tracking error, maximum speed and altitude.

Extension

  • Add a battery threshold from /fmu/out/battery_status that 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

Troubleshooting
SymptomLikely causeWhat to check
Vehicle overshoots waypointsSetpoint steps too large or acceptance radius too smallRate-limit the setpoint; widen the radius slightly
Mission stallsAcceptance never satisfied due to offset or NED sign errorPrint the distance to the target each second
Drops out of offboard mid-missionPublisher stalled by mission logicKeep 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.