Page 1
1
Practical Work II Introduction to Mission Planner
and APM Autopilot
1. Introduction In this Practical Work you will be introduced to the APM autopilot system, and its Ground Control Software
system called Mission Planner. You will also see how to connect the APM to Mission Planner, how to
upgrade the APM’s firmware, and how to calibrate the APM.
2. Mission Planner Mission Planner is a Ground Control Software (GCS) system for the APM and Pixhawk series of low-cost
open source/open hardware autopilot systems. Mission Planner lets you upgrade the firmware of the
autopilot, get live telemetry readings, configure and tune the autopilot system, and like its name suggests,
lets you program a mission into the autopilot.
We will cover autopilot missions in a later Practical Work.
2.1 Obtaining Mission Planner You can obtain Mission Planner from the Mission Planner Download Page at
http://ardupilot.com/downloads/?category=4&sortby=hits
Mission Planner has already been installed for you on the lab’s computers, so this is just for your
information.
Scroll to the bottom of the screen and click on Mission Planner Installer – Permanent Link to Latest MSI”
as shown below.
(Note: Mission Planner is written in C#.NET and is only available for Windows machines)
Page 2
2
Once the MSI has been downloaded, double click to launch it, and follow the instructions to install the
software.
NOTE: The Mission Planner MSI will ask you to install several drivers. Please install ALL of these drivers or
you will not be able to connect to the APM.
3. The APM Autopilot The APM Autopilot is a popular, low cost autopilot system based on the Atmel Atmega 2560
microcontroller system. The APM autopilot uses the same firmware as more expensive (and more
powerful) autopilots like the Pixhawk PX4.
3.1 Parts of the APM Autopilot The current APM is version 2.6. This is almost identical to APM 2.5, except that the magnetometer
(compass) has been moved to a separate unit. This allows UAS designers to position the magnetometer
away from interference sources like the motors and electronic speed controllers.
The figure below shows the top view of the APM 2.6:
Page 3
3
Inputs from RC Radio
These are connected to the radio control (RC) radio, like the R617FS radio that comes with the Futaba EX6
RC system we are using in this Summer Programme, shown below:
Analog Outputs Telemetry
Port
Inputs from RC
radio Control outputs
to motors.
Power Module
Socket Compass port Reset Button GPS Port
Page 4
4
Each channel on the APM has an assigned purpose. We will see more about channel assignments when
we connect the APM to the Futaba radio.
Note that only the Signal pin of the radio (the innermost pins circled above) need to be connected to the
Signal pin on the APM RC radio input (marked “S” on the APM casing). However at least one of the ports
on the R617S must have all 3 pins connected to a port on the APM. This is because the remaining two pins
deliver power to the radio.
Control Outputs to Motors
These pins are connected to the electronic speed controllers that control the motors of the UAS. The APM
uses this pins to balance, pitch, roll and yaw the UAS.
Power Module Socket
The APM comes with a power module shown below:
The small plastic connector circled above plugs into this socket to supply power to the APM.
Reset Button
As its name suggests, pressing this button reboots the APM. This is very useful particularly when
developing control algorithms using MAVLink, covered in a later topic.
Page 5
5
Compass Port and GPS Port
The APM also comes with a 3DR uBlox compass and GPS unit shown below:
This unit has a compass output port that connects to the APM’s compass port, and a GPS output port and
connects to the APM’s GPS port.
The compass tells the APM which direction it is facing (note the arrow on the 3DR uBlox unit, which must
point forward), as well as its 3D GPS coordinates (latitude, longitude and altitude).
Telemetry Port
This port is normally connected to a telemetry radio like the 3DR Telemetry Radio or XBee radios, to
transmit information like speed, roll, pitch, yaw, latitude, longitude, altitude, etc to the ground control
software (GCS), and to receive mission instructions from the GCS. In our Summer Programme we will
connect this to an onboard computer (OBC) instead.
Analog Outputs
These output a signal of between 0 and 5v, controlled by the APM firmware, and are used for specialized
purposes like to control a camera gimbal for aerial photography.
3.2 Connecting the APM to Mission Planner Flip the APM 2.6 onto its side with the GPS port pointing downwards, and you will see the APM’s USB port
as shown below. There is a micro-USB cable. Use this to connect the APM to your PC’s USB port.
Page 6
6
When connected the APM will start up, and you will see a series of fast blinks from the blue and red LEDs
on the APM. These LEDs will eventually settle into a steady slow blinking. If you are connecting the APM
to your computer for the first time, your PC may take a while to install the drivers.
Now start up Mission Planner. When it starts up you will see a screen like this.
There are two drop-down boxes on the top right of the screen (circled in yellow above). Click on the first
dropdown box, and you will see a list of connection options
Page 7
7
Find the option that says something like COM6 Arduino Mega 2560 (COM6) and select that. Note that on
your computer it will most likely say something else other than COM6. The second drop box lets you select
the communication speed. Make sure this reads 115200. Now click on the Connect button at the top right
corner of the screen.
When you do so, you should get a small box that says MAVLINK Connecting. This means that the ground
control software is attempting to communicate with the APM using the MAVLINK protocol, which you will
also learn about in this programme.
(NOTE: MISSION PLANNER MAY FAIL TO CONNECT TO THE APM IF THERE IS NO
FIRMWARE LOADED. IF THIS HAPPENS SKIP TO SECTION 3.3)
Page 8
8
If the connection is successful, Mission Planner will now begin reading all the various parameter settings
on the APM.
Page 9
9
Once this is done the little box disappears. Try tilting the APM and see if the artificial horizon responds. It
may or may not respond since the APM unit you have may not have a firmware flashed onto it yet.
This is the next step.
3.3 Flashing the Firmware “Firmware” is a special class of software that is permanently stored on an embedded device, for example
in its flash memory, or in older embedded systems, on a separate EPROM chip. The firmware gives the
embedded device its capabilities.
In the case of the APM, the firmware allows the APM to control a UAS, to receive commands from the
radio control, and to communicate using MAVLINK.
The APM that you receive may not have a firmware loaded, or it may be loaded with an obsolete firmware.
Follow these instructions:
i) Click on the CONNECTED button at the top right hand corner of the screen to disconnect the
APM.
ii) Click on the button that says “INITIAL SETUP” on the top of the screen. The two buttons are
circled below:
Page 10
10
iii) Select Install Firmware at the left menu on the screen that follows. A small box will appear
that says “Getting FW List”. When it disappeares your screen will now look like this:
iv) Since the F450 that you are going to use is an X-frame, select ArduCopter V3.2.1 Quad by
clicking on it (circled above). A dialog box will appear asking “Are you sure you want to upload
ArduCopter V3.2.1 Quad?”. Click Yes.
v) A second dialog box saying ‘This board has been retired.” will appear. Click OK. Mission
Planner will now proceed to download and install the latest firmware on the APM. When
completed a dialog box that says “Warning, if you are installing AC 3.2 for the first time you
MUST redo a Compass calibration.” Click OK.
3.4 Calibrating the APM The APM’s many sensors tell it what position the UAS is in, which direction it is pointing, how high up
it is, etc. However these sensor readings simply come in the form of a large amount of numbers. The
APM needs to know when these numbers are telling it that the UAS is upside down, or in the air, etc.
To help the APM we perform a process known as “calibration”, which helps the APM determine the
minimum and maximum possible values from the sensors.
i) To begin, click CONNECT at the top right corner of the screen to connect to the APM.
ii) When the APM’s parameters have been fully loaded, click “>> Mandatory Hardware” on
the left side of the screen. This will expand the list, and your screen will look like this:
Page 11
11
iii) Click “Frame Type” , then select the “X, Y6A” radio button.
Page 12
12
3.4.1 Calibrating the Accelerometers
iv) We will now calibrate the accelerometers. These sensors tell the APM about the position
of the APM (whether it is on a flat surface, tilted, etc). Click “Accel Calibration” on the left
of the screen. The begin, notice that there is an arrow saying “FORWARD” on the top of
the APM. This arrow tells you which way is front.
Ensure that this arrow is always POINTING AWAY from you!
v) Now click on the green “Calibrate Accel” button:
Page 13
13
Follow the instructions on the screen:
a) “Place the vehicle level and press any key”
Put the autopilot FLAT on the lab benchtop, and press any key on the PC’s
keyboard.
b) “Place vehicle on its LEFT and press any key”
With the FORWARD arrow pointing away from you, place the autopilot on its
left side and press any key on the PC’s keyboard.
c) “Place the vehicle on its RIGHT and press any key”
With the FORWARD arrow pointing away from you, place the autopilot on its
right side and press any key on the PC’s keyboard.
d) “Place the vehicle nose DOWN and press any key”
Place the autopilot with the FORWARD arrow pointing towards the floor, and
press any key on the PC’s keyboard. Try to position the autopilot as vertically
as possible.
e) “Place the vehicle nose UP and press any key”
Place the autopilot with the FORWARD arrow pointing towards the ceiling,
and press any key on the PC’s keyboard. Try to position the autopilot as
vertically as possible.
f) “Place the vehicle on its BACK and press any key”
Place the autopilot upside down on the lab bench and press any key on the
PC’s keyboard.
If all goes well, Mission Planner should say “Calibration successful”.
3.4.2 Calibrating the Compass
We will now calibrate the compass. This lets the APM know which direction is north, and where
the APM is currently facing.
IMPORTANT: Ensure that you do not have any magnetic objects, including
mobile phones or tablets with 3G/WiFI near the APM. This will affect the
calibration!
a) Take the GPS/Compass module, and the two cables that come with it.
Connect the port on the module labled GPS to the GPS port on the APM, and
the port labeled “MAG” to the compass port on the APM (the compass port
is labled “I2C”)
Page 14
14
b)
c) Click “Compass” on the left menu. This will produce the following screen:
Click on the “APM with External Compass” radio button to select it. Click “Live
Calibration”. A dialog box that says “Please click ok and move the autopilot
around all axises in the circular motion”. Click OK. This will bring you to a
screen showing a 3D axis and some white dots.
Page 15
15
d) Now this is the tricky bit. Point the compass so that the white arrow is facing
NORTH (use your mobile phone to see where north is), then turn the compass
module about its X-axis several times.
As you rotate you will see a trail of colored dots. Try to hit as many of the white
dots as you can.
e) Rotate the module 90 degrees, and turn it around its Y-axis several times.
again rotate the module 90 degrees and turn it around its Z-axis several times.
f) Keep repeating this until the Mission Planner says “Enough”. It will then
inform you of the sensor offsets it will use. Click OK.
3.4.3 Other Calibrations
At this point your APM is still not flight-ready. There are still several more calibrations to be done:
a) Radio calibration: Tells the APM how to understand the RC radio inputs.
b) Flight Modes: Tells the APM how to interpret RC switch inputs to choose the correct
flight modes.
However as these are fairly complicated, we will do these calibrations together.
Page 16
16
4. The Mission Planner Flight Data Screen Click on the “Flight Data” button on the top button bar. This brings up the screen shown below:
You will see an artificial horizon display. Tilt the autopilot or turn it around, and you will see a live
feed of the orientation of the autopilot.
You will also see a row of tabs. By default you will see the Quick tab, which gives you information
about yaw angle, etc.
Click on “Gauges” to produce this very interesting display showing compass heading, vertical
speed, etc:
Page 17
17
The most interesting tab is “Status”, which will give you a live feed of the APM’s sensors. We will
use this tab in a later session to help you connect up the motors.
Feel free to play around with the Mission Planner. There are other interesting options like
SIMULATION that will let you connect the APM to a the X-Plane flight simulator to perform
“Hardware-in-the-Loop” simulation.
5. Entering Missions in the Mission Planner Mission Planner’s greatest asset of course is its ability to enter missions quickly. A mission is a list
of actions and waypoints (places the UAS should fly to) that the UAS should accomplish. Once a
mission has been programmed into the UAS, the UAS can fly the missions when switched to AUTO
mode (more about modes later). In a later assignment you will see how to set missions using
programs.
WARNING:
WE ARE GOING TO ENTER REAL GPS COORDINATES OF REAL PLACES IN
SINGAPORE.
ONCE PROGRAMMED DO NOT SWITCH THE QUADCOPTER TO AUTO MODE
OR IT WILL ATTEMPT TO FLY THE MISSION AND WILL CRASH INTO PEOPLE,
TREES, CARS AND BUILDINGS!
With that warning out of the way, let’s see how to enter missions.
Page 18
18
5.1 Set Your Units. The first thing you should do is to set the units for Mission Planner. This is important because you don’t
want to be reading a distance that is shown in meters, thinking that the reading is in feet.
To set your units, click on the CONFIG/TUNING button at the top of the screen, and then Planner on the
left menu bar.
Look for “Dist Units” and make sure it is set to metres, and Speed Units and set it to ms (meters per
second).
5.2 Entering a Mission To start entering a mission, click on the Flight Plan button at the top of the screen. You will get a screen
like this (hopefully showing where you are). There will be a tear-drop shaped marker to show you where
HOME is.
Since you have not yet used a GPS with your APM yet, the HOME marker might not be in Singapore, but
we will make use of what we have for now.
Page 19
19
Also notice the large red circles. These are “NO FLY ZONES”, areas within 5 km of airports where you
cannot fly your quadcopter.
To enter a mission:
i) Drag the HOME indicator to your expected launch point. Sadly the map for Singapore is
quite unclear, so this may be a little difficult.
If you’ve ever used this APM module with a GPS, the HOME location is set to where you
last armed the APM.
ii) There is a green bar at the bottom with small up-arrows on the right (circled in RED
above). Click on those arrows to see the list of mission commands:
Page 20
20
iii) There is a checkbox that says “Verify Height” (circled in RED above). When checked,
Mission Planner will check the altitudes that you set to ensure that you don’t fly into a hill
or other natural obstruction.
Note that Mission Planner only knows about terrain; it is not able to check whether you
are going to fly into a building or a tree.
iv) To enter waypoints, just click on the map where you want to go. You will see a new entry
in the list of mission commands.
Page 21
21
v) In the list you can:
a) Choose what to do in the Command dropbox. Here the quadcopter is going to do a
“spline waypoint”. I.e. it will fly to the new point, using an algorithm to ensure that
the quadcopter flies smoothly. This is different from a “waypoint” where the
quadcopter just flies directly to the waypoint even if it has to make abrupt changes in
direction. There are literally a ton of things you can do from this menu. You can
choose to land, change speed, or even grip an item if you have a gripper
(DO_GRIPPER). Of course this only makes sense for land robots.
b) Set the Latitude and Longitude of the new waypoint. This gives you precise control
over where the waypoint should be.
c) Set the altitude you want to be at the waypoint. The quadcopter will climb or descend
to this new altitude as it flies there. Change the altitude for all waypoints to 50m.
d) Delete, move up or down a waypoint.
vi) Click two or three more points to add more waypoints. When you are done, click the
leftmost column of the last entry to select it. It will be highlighted as shown here:
Page 22
22
vii) Now we want to add a new command. To do this, click the green “Add Below” button,
and a new row will appear below the highlighted row. The path on the screen will also go
all crazy as shown:
Page 23
23
viii) Now click on the command dropbox for the new entry, and select
“RETURN_TO_LAUNCH”. Hit ENTER to register this new point. This will make the
quadcopter fly back to the starting point. Notice that the circle is now closed again.
ix) To save the waypoints in a file, click “Save WP File”. This will bring up a dialog box like so:
Page 24
24
Enter the filename into “File name”, and click Save.
x) The next thing you’ll want to do is to flash the mission onto the APM. To do so, ensure
that the APM is connected to the PC, and that Mission Planner is connected to the APM,
then click on the “Write WP” button on the right of the screen. When you do so, you will
get a dialog box like this:
Once it says done, it means that the mission has been written onto the APM. The next
time you take off and switch the quadcopter to AUTO, it will execute this mission.
WARNING:
MISSIONS ARE WRITTEN ONTO THE APM’S EEPROM MEMORY. THEY WILL STILL BE
PRESENT EVEN AFTER YOU POWER OFF THE APM, AND POWER IT BACK ON.
NEVER SET YOUR APM TO AUTO UNLESS YOU KNOW EXACTLY WHAT MISSIONS HAVE
BEEN STORED!
xi) Of course you can also click “Load WP File” to load a previously saved set of waypoints.
Likewise you can click “Read WPs” to read the mission currently stored on the APM.