Skip to main content
Substrate exposes PX4 drone control through 7 flight commands available via the AI assistant and the drone command palette. Each command is sent as a MAVLink COMMAND_LONG message to PX4 SITL.

Flight Commands

CommandMAV_CMDIDParameters
ArmMAV_CMD_COMPONENT_ARM_DISARM400arm=1
DisarmMAV_CMD_COMPONENT_ARM_DISARM400arm=0
TakeoffMAV_CMD_NAV_TAKEOFF22altitude_m (1—120m, default 5m)
LandMAV_CMD_NAV_LAND21(none)
Return to LaunchMAV_CMD_NAV_RETURN_TO_LAUNCH20(none)
Set ModeMAV_CMD_DO_SET_MODE176mode string
Go ToMAV_CMD_DO_REPOSITION192x, y, z (ENU meters relative to home)
Every command returns a response containing a success boolean, a result string (ACCEPTED, DENIED, etc.), and an error message if the command was rejected.

Supported PX4 Modes

The flight_set_mode command accepts the following mode strings. Substrate maps each to PX4’s internal base_mode + custom_main_mode + sub_mode system.
Mode StringAliasesDescription
MANUALFull manual control via RC transmitter
STABILIZEDSTABILIZEAttitude stabilization, manual throttle
ALTCTLALTITUDEAltitude hold, manual position
POSCTLPOSITIONPosition hold with GPS
OFFBOARDExternal control via MAVSDK/ROS 2
HOLDLOITERHold current position and altitude
MISSIONExecute autonomous waypoint mission
RTLRETURNReturn to launch point and land
LANDLand at current position
TAKEOFFAutomatic takeoff to set altitude
GUIDEDMaps to POSCTL (see note below)
PX4 does not have a GUIDED mode like ArduPilot. When you set mode to GUIDED, Substrate maps it to POSCTL (position control). Use OFFBOARD mode for programmatic waypoint following via MAVSDK.

Using Flight Commands

Via AI Assistant — ask the assistant naturally:
  • “Arm the drone and take off to 10 meters”
  • “Switch to position hold mode”
  • “Go to coordinates 5, 3, 10”
  • “Land the drone”
  • “Return to launch”
Via Command Palette — the SITL panel includes quick-action buttons for Arm, Disarm, Takeoff, Land, and RTL. These are available when a simulation is running and the autopilot is connected.

Readiness States

Before a drone can accept flight commands, it must progress through readiness states:
  1. Launching — Container starting
  2. BridgeConnected — gRPC bridge online
  3. WorldLoaded — Gazebo world loaded
  4. Rendering — 3D scene streaming
  5. AutopilotConnected — MAVLink heartbeat received
  6. ReadyToArm — EKF converged, GPS lock acquired
  7. FullyOperational — Armed and ready for flight commands
The AI assistant’s wait_for_simulation_ready tool waits for a target state before proceeding. The default target is ReadyToArm.
Arming sends a real MAVLink ARM command. When connected to physical hardware (not simulation), this will spin up motors. Always verify you are connected to a simulation before testing flight commands.