Skip to content
Arthur Benemann edited this page Mar 15, 2013 · 1 revision

See the APM MAVLink commands page for mission scripting with APM 2.0

In APM there is command hierarchy. Urgent commands are done immediately and in preference to other, less urgent, commands. When the processor has time the less urgent commands will be run.

Examples of urgent commands are: reading RC radio stick positions, flight stabilization.

Examples of medium urgency commands are: calculations for navigation, and sending telemetry data.

Examples of low urgency commands (i.e. can wait) are: reading RC radio flight mode switch, and logging data to APM’s memory.

This command hierarchy is implemented in software with A) fast, medium and slow loops and B) a command bumping

APM's v1.0 firmware uses a new “command” list for AUTO mode, versus the “waypoint” list used in !ArduPilot.

Commands have 3 different levels of priority. They are:

  • Level 1 - Commands that must be completed before another command of that level will be processed. For example, command 0x10 is a command to navigate to a waypoint.
  • Level 2 - Commands that may be completed, but may be cleared by a level 1 command being completed first. For example, command 0x20 is a command to delay a given number of seconds before executing the next Level 2 or Level 3 command.
  • Level 3 - Commands that execute immediately if they are processed. For example, command 0x40 is a command to change the cruising speed to a given value.

When AUTO mode is entered the first level 1 command in the list will be found and executed. The autopilot will then look for any Level 2 or 3 commands before the next Level 1 command and execute them in order. When a Level 2 command is executed it must be completed before any further Level 2 or 3 commands are executed.

When an active Level 1 command is completed any Level 2 command in process will be discontinued, and any Level 2 or 3 commands preceding the next Level 1 command that have not been executed will be dropped.

Following these rules you can plan detailed missions with great flexibility.

Commands

**Command ID** **Name** **Parameter 1** **Parameter 2** **Parameter 3** **Parameter 4**
0x10 Navigate to waypoint altitude lat lon
0x11 Loiter (indefinitely) altitude lat lon
0x12 Loiter X turns turns altitude lat lon
0x13 Loiter X time time (seconds*10) altitude lat lon
0x14 RTL altitude lat lon
0x15 Land altitude lat lon
0x16 Takeoff min pitch (with airspeed), desired pitch without airspeed altitude
0x20 Delay before next command time (seconds)
0x21 Ascend/descend at rate rate (cm/sec) alt (finish)
0x30 Change Mode mode #
0x31 Reset command index to 1
0x32 query variable X variable ID
0x33 broadcast variable x variable ID
0x34 turn on/off telemetry off/on = 0/1
0x40 Change cruise speed cruise speed
0x41 Change cruise throttle cruise throttle
0x42 Reset home altitude lat lon
0x60 Change Kp gain value array index gain value ** 100,000
||0x61||Change Ki gain value||array index||gain value ** 100,000|| ||0x62||Change Kd gain value||array index||gain value ** 100,000|| ||0x63||Change Integrator max||array index||gain value ** 100,000|| ||0x64||Change Kff gain value||array index||gain value * 100,000|| ||0x70||Change radio_trim||array index||value|| ||0x71||Change radio_max||array index||value|| ||0x72||Change radio_min||array index||value|| ||0x73||Change other radio||array index||value (index 0=elevon 1 trim, 1=elevon 2 trim, 2=ch3_fs)|| ||0x70||Change radio_trim||array index||value|| ||0x71||Change radio_max||array index||value|| ||0x72||Change radio_min||array index||value|| ||0x73||Change other radio||array index||value (index 0=elevon 1 trim, 1=elevon 2 trim, 2=ch3_fs)|| ||0x75||Change the current command index||array index||value|| ||0x80||repeat an event at an interval||event id||value||delay in sec||repeat count (0 = forever)|| ||0x81||Set the Relay||0 or 1|| || || || ||0x82||Set Servo # to PWM||0 - 7||0 - 2000 (PWM)|| || ||

Event Id's for repeating events:

  • CH_4_TOGGLE
  • CH_5_TOGGLE
  • CH_6_TOGGLE
  • CH_7_TOGGLE
  • CH_8_TOGGLE
  • RELAY_TOGGLE

Servo toggle read the current position of the servo, then drive the servo to the desired position. One second later the servo returns to the saved position.

Clone this wiki locally