Mission Planner Simulated Ardupilot

Overview

Ardupilot is a firmware that is commonly run on consumer off the shelf (COTS) flight controllers that WARG uses. These devices use MAVLink as their primary telemetry communication protocol.

Software simulation of hardware components allows testing of software components without requiring hardware to be physically present. This is known as software in the loop (SITL).

The Ardupilot SITL Simulator lets WARG test software using MAVLink without requiring a physical drone.

Mission Planner

Download and install Mission Planner: https://ardupilot.org/planner/docs/mission-planner-installation.html

  • Windows only, not tested on Linux

Follow the steps here: https://ardupilot.org/planner/docs/mission-planner-simulation.html#setup-and-use

  • The Simulation tab is at the top of the screen

  • Select Multirotor in the bottom centre and Stable , unless you specifically need another vehicle

    • If you have already run Multirotor at least once, you can select the Skip Download button in the bottom left

    • The default start location is near Canberra Airport in Australia. If you want a different location, you can add --home=[location] to the Extra command line text box in the centre, where [location] is: [latitude in decimal degrees],[longitude in decimal degrees],[ground ASL in metres],[initial heading in degrees]

      • Example E5: --home=43.472978,-80.540103,336,0

      • Example WRESTRC: --home=43.43405014107003,-80.57898027451816,373,0

      • Example Alma, QC: --home=48.5102184,-71.6473002,128,0

Mission Planner automatically downloads and runs the SITL files, and then connects to the simulated vehicle.

Mission Planner is ready to be used as though it is connected to a real drone!

MAVLink forwarding

Mission Planner can be used as a bridge between the drone and another application:

  1. Ctrl+f

  2. Click on Mavlink

    1. If you are running another application, proceed to step 3

    2. If you are observing MAVLink telemetry messages only, proceed to step 4

  3. Another application:

    1. In the upper dropdown, select TCP Host - 14550

    2. Check the Write access checkbox

    3. Click Connect

    4. Enter port 14550 , unless you are specifically using another port

    5. Click OK

    6. The application is ready to receive telemetry and send commands

  4. Observation only:

    1. In the upper dropdown, select UDP Client

    2. Leave the Write access checkbox unchecked

    3. Click Connect

    4. Enter 127.0.0.1 , unless you are specifically using another IP

    5. Enter port 14550 , unless you are specifically using another port

    6. Click OK

    7. Mission Planner is now broadcasting telemetry

You can also observe some of the MAVLink messages through Mavlink Inspector (ctrl+f).

If you want to switch or change connection settings, you have to restart Mission Planner and follow the instructions again.

Sources: https://ardupilot.org/planner/docs/common-mp-tools.html

You can also directly connect to the SITL (after you start it up on Mission Planner) using TCP port 5762 or 5763 (5760 is reserved for connecting to Mission Planner). This may or may not better simulate the airside computer

Sources: https://ardupilot.org/dev/docs/using-sitl-for-ardupilot-testing.html https://ardupilot.org/dev/docs/learning-ardupilot-uarts-and-the-console.html

Common errors

No connection could be made because the target machine actively refused it

  • Did you start forwarding at all, and with the correct settings?

dronekit.TimeoutError: wait_ready experienced a timeout after 30 seconds.

  • Restart Mission Planner and follow the instructions again. Do not forget to check Write access

Ardupilot only

Untested.

The Ardupilot website has extensive documentation on setting up the SITL found here (SITL Simulator (Software in the Loop) — Dev documentation). You may be able to download the SITL binary without compiling yourself by downloading the firmware from here: ArduPilot firmware : /Copter/latest. And use https://github.com/ArduPilot/ardupilot/blob/master/Tools/autotest/sim_vehicle.py to run it. (although this is untested).

DroneKit

Untested.

DroneKit also has a SITL simulator.

TODO: Links

Additional Resources

Video tutorial

https://www.youtube.com/watch?v=GFxwRgntGlQ&ab_channel=Karthik%27sTechTime