common-Planning a Mission with Waypoints and Events

Table of Contents

Planning a Mission with Waypoints and Events


In Mission Planner you can create missions use the easy point-and-click Waypoint Editor created by Michael Oborne.

Note: Although this uses APM:Copter as the main example the primary methods apply for APM:Plane and APM:Rover although altitude control is severely limited in APM:Rover.

It is very important to acquire GPS lock before arming in order for RTL, Loiter, Auto or any GPS dependent mode to work properly.


Basic waypoint commands

A mission file is a little intimidating to the human eye, but is a powerful scripting language for the autopilot. (Again, remember that the GCS will soon take care of all of this for you. You shouldn’t have to see it yourself for long!).

You can have as many commands as you want, ranging from pre-programmed ones to ones that you can create. Here are some common ones:

  • {NAV_WAYPOINT n/a, alt, lat, lon}
  • {NAV_TAKEOFF pitch, target altitude}
  • {NAV_LAND n/a, alt, lat, lon}
  • {DO_JUMP waypoint, n/a, repeat count, n/a} Goes to that waypoint and resumes mission there. Set repeat count to any number greater than 1 to do it that many times. or to -1 to do it forever. Good for looping missions.

(Note: DO_xxx commands currently need a dummy waypoint placed after the command
eg:

WAYPOINT_1
DO_SET_HOME
WAYPOINT_2

Home will be set at WAYPOINT_1 but will not work if WAYPOINT_2 is not there.)

You can read more about auto landing and takeoff here.


Tips

  • Prefetch: You can cache map data so you don’t need Internet access at the field. Click the Prefetch button, and hold down Alt to draw a box to download the selected imagery of a location.
  • Grid: This allows you to draw a polygon (right click) and automatically create waypoints over the selected area. Note that it does not do “island detection”, which means if you have a big polygon and a little one inside of that, the little one will not be excluded from the big one (see this for more). Also, in the case of any polygon that partialy doubles backs on itself (like the letter U), the open area in the center will be included as part of the flyover.
  • Setting your home location to the current location is easy, just click “Home Location” above where you enter your home location, and it will set your home location to the current coordinates.
  • You can measure the distance between waypoints by right-clicking at one end and selecting Measure Distance. Then right-click on the other end and select Measure Distance again. A dialog box will open with the distance between the two points.

Setting the Home Position

For APM:Copter the home position is set as the location where the copter was armed. This means if you execute an RTL in APM:Copter, it will return to the location where it was armed, so arm your copter in the location you want it to return to.

For APM:Plane the home position is the location of the plane where the GPS was locked. This means if you execute an RTL in APM:Plane, it will return to the location where it first acquired the GPS lock, so only power up your plane in the location you intend it to return to when performing an RTL.


Video: Produce and save a Multi-waypoint Mission


Video: Load an already saved Multi-waypoint Mission


MissionPlanning


Instructions


Note: When APM:Copter executes the Land command it will land from its current location. It will not fly to a location, then land like the planes do. If you want to land at a particular waypoint, you must fly to a normal WP, then the next command will be Land. The Absolute Altitude checkbox in the Mission Planner is ignored. ArduCopter only uses the default relative altitude.


In the screenshot above, a mission for arducopter starts with an auto takeoff to 20 meters attitude; then goes to WP 2 rising to 100 meters altitude on the way, then waits 10 seconds; then the craft will proceed to WP 3 (descending to 50 meters altitude on the way), then returns to launch.  Since the default altitude is 100 meters, the return to launch will be at 100 meters.  After reaching the launch position, the craft will land. The mission assumes that the launch position is set at the home position.

You can enter waypoints and other commands (see below for the full list). In the dropdown menus on each row, select the command you want. The column heading will change to show you what data that command requires. Lat and Lon can be entered by clicking on the map. Altitude is relative to your launch altitude, so if you set 100m, for example, it will fly 100m above you.

Default Alt is the default altitude when entering new waypoints. It’s also the altitude RTL (return to launch) mode will fly at if you have “Hold Default ALT” checked; if you don’t have that checked, your aircraft will try to maintain the altitude it was at when you switched on RTL.

Verify height means that the Mission Planner will use Google Earth topology data to adjust your desired altitude at each waypoint to reflect the height of the ground beneath. So if your waypoint is on a hill, if this option is selected the Mission Planner will increase your ALT setting by the height of the hill. This is a good way to make sure you don’t crash into mountains!

Once you are done with your mission, select “Write” and it will be sent to APM and saved in EEPROM. You can confirm that it’s as you wanted by selecting “Read”

You can save multiple mission files to your local hard drive by selecting “Save WP File” or read in files with “Load WP File” in the right-click menu:


Auto grid

You can also have the Mission Planner create a mission for you, which is useful for function like mapping missions, where the aircraft should just go back and forth in a “lawnmower” pattern over an area to collect photographs.

To do this, in the right-click menu select Polygon and draw a box around the area you want to map. Then select Auto WP, Grid. Follow the dialog box process to select altitude and spacing. The Mission Planner will then generate a mission that looks something like this:


Basic waypoint commands


WAYPOINT

Option Alt Lat Lon
Delay (seconds) Altitude (meters) Latitude Longitude
  • Mavlink command is NAV_WAYPOINT
  • Delay option is triggered after the craft reaches the waypoint radius. The Next command is loaded after the delay.
  • Delay time is in seconds, the default is 0

Waypoint Option Bitmask – not yet available in the Mission Planner

bit 0 Altitude is stored 0: Absolute 1: Relative
bit 1 Change Alt between WP 0: Gradually 1: ASAP
bit 2
bit 3 Req.to hit WP.alt to continue 0: No 1: Yes
bit 4 Relative to Home 0: No 1: Yes
bit 5
bit 6
bit 7 Move to next Command 0: YES 1: Loiter until commanded

LOITER_UNLIM

Option Alt Lat Lon
N/A N/A N/A N/A
  • Will cause the craft to begin to Loiter at the current location when the command is invoked.

LOITER_TIME

Option Alt Lat Lon
Time in seconds Altitude (in meters) Latitude Longitude
  • Will cause the craft to begin to Loiter at the current location when the command is invoked.
  • Optionally give a location to loiter at that wp – The clock starts ticking after the WP is reached.

LOITER_TURNS

Option Alt Lat Lon
Number of turns (N x 360°) N/A N/A N/A
  • Will cause the craft to begin to orbit the current location when the command is invoked.

RETURN_TO_LAUNCH

Option Alt Lat Lon
N/A Altitude (meters) N/A N/A
  • Will cause the craft to return to the home position set when the craft is armed (requires GPS Lock!)
  • If Altitude is 0, craft will return to home at the altitude specified by the Mission Planner

LAND

Option Alt Lat Lon
N/A N/A N/A N/A
  • Will cause the craft to land at the current location when the command is invoked.
  • If you have Sonar, the craft will stop holding position at 3 meters and drop straight down.
  • The motors will not stop on their own, you must exit the AP mode to cut the engines

TAKEOFF

Pitch* Alt Lat Lon
Climb angle* Altitude (meters)** N/A N/A
  • Will cause the craft to take off and hold position until the altitude is reached.

* APM:Plane only. This is the MIN climb angle the when using an airspeed sensor, and MAX angle when not using an airspeed sensor.
** The altitude the plane will climb to before going to the next waypoint. The plane is only attempting to climb at this point and can be pushed off its heading by wind.


CONDITION_DELAY

N/A N/A Time in Seconds N/A
  • Will delay the execution of the next conditional command.

CONDITION_DISTANCE

N/A N/A Distance (meters) N/A
  • Will override the next waypoint altitude.
  • Useful when used after a delay or distance conditional command

CONDITION_CHANGE_ALT

Option Alt Lat Lon
N/A Altitude (meters) N/A N/A
  • Will override the next waypoint altitude.
  • Useful when used after a delay or distance conditional command

CONDITION_YAW

Option Alt Lat Lon
Direction (1=clockwise, 0=counter) Relative: amount (degrees), Absolute: ending angle(degrees) Speed (meters/s) Relative angle change = 1, Absolute = 0
  • Fine grain controls of the Yaw

DO_SET_MODE

Option Alt Lat Lon
  • Not Implemented

DO_JUMP

Option Alt Lat Lon
The desired command index # of Jumps

DO_CHANGE_SPEED

Option Alt Lat Lon
Speed (in meters/s)

* Speed change will stick until reboot


DO_SET_RELAY

Option Alt Lat Lon
1 = on, 0 = off, -1 = toggle N/A N/A N/A

* Toggling the Relay will turn an off relay on and vice versa


DO_REPEAT_RELAY

Option Alt Lat Lon
N/A # of repetitions cycle time (in seconds) >N/A

* Toggling the Relay will turn an off relay on and vice versa


DO_SET_SERVO

Option Alt Lat Lon
Servo channel (1-8) PWM (1000-2000) N/A N/A

DO_REPEAT_SERVO

Option Alt Lat Lon
Servo channel (5-8) PWM (1000-2000) # of repetitions cycle time (in seconds)

DO_CONTROL_VIDEO

Option Alt Lat Lon

DO_SET_ROI

Yaw tracking option Altitude (in meters) Latitude Longitude
  • Setting will persist until the next waypoint is reached.

Note: When you’re using the Jump command, remember that waypoint logic can be a bit confusing. A waypoint command means “start heading to this WP”, not “wait until you get to this WP.” So, for example, if you put a “Jump to WP1″ command in-between WP4 and WP5, the aircraft will never get to WP5. That’s because once it starts heading in the direction of WP5, it then executes the next command, which is the jump, and that takes priority. So in that instance, if you want the aircraft to hit WP5, you’d create a fake WP6 and issue the Jump command after that.


A full guide to MAVLink command and parameter syntax for developers can be found in the Developer section. (Click on Community, select Developer, then look in the table of contents. 


How to prefetch a stored Mission Map


Occasionally You will see some really big Numbers


Questions about this page? Comments? Suggestions? Post to APM Forum! Use the platform specific to your query, and make sure to include the name of the page you are referring to.

Comments are closed.