Compiling Ardupilot for Navio2 on Raspberry Pi

Instructions for compiling Ardupilot on a Raspberry Pi board with Navio2 for Ardupilot:Copter.

With using a Navio2 module board, we can turn a Raspberry Pi board (currently supports RPi 2/3/4) into a flight control platform that runs Ardupilot on top of real-time Linux. While Emlid offers pre-built Ardupilot in their Raspbian image, you may want to compile it by yourself if you are developing Ardupilot. In this post, we take Ardupilot:Copter as an example and talk about how compiling is done.


A Quick Glance

# To get source code
git clone https://github.com/ArduPilot/ardupilot
cd ardupilot
git checkout Copter-3.6.11
git submodule update --init --recursive

# To compile
alias waf="$PWD/modules/waf/waf-light"
waf configure --board=navio2
waf copter

# To launch
sudo build/navio2/bin/arducopter -A udp:192.168.1.9:14550​

Assumptions

I assume that you already have a Raspberry Pi + Navio2 system with configurations proven to work with Ardupilot. This is usually the case when you use the Raspbian image provided by Emlid.
Here we just want to download a separate copy of Ardupilot, compile directly on our Raspberry Pi board (2/3/4) and run it.


[Step 1] Get Ardupilot Source Code

Get the Ardupilot source code from either the official repository or yours.
To make sure your Ardupilot will work correctly with Navio2, you may want to use the Ardupilot versions suggested by Emlid [ref]. I pasted the currently supported versions below for your reference (last checked: Feb-2020):

  • ArduCopter: 3.6.11
  • ArduPlane: 4.0.0
  • ArduRover: 4.0.0
  • ArduSub: 3.5.4

Run the following instructions to get the Ardupilot code from the official repository (or yours) and switch to the branch/tag you desire (we use Copter-3.6.11 as an example here):

git clone https://github.com/ArduPilot/ardupilot
cd ardupilot
git checkout Copter-3.6.11
git submodule update --init --recursive

[Step 2] Compile Ardupilot

Now you should still be in the ./ardupilot folder we just entered. Compile Ardupilot:

alias waf="$PWD/modules/waf/waf-light"
waf configure --board=navio2
waf copter

Once the compiling is done correctly, an Ardupilot binary will be generated under the folder ardupilot/build/navio2/bin.


[Step 3] Launch Ardupilot

Launch the Ardupilot you just compiled:

sudo build/navio2/bin/arducopter -A udp:192.168.1.9:14550​

You should now see the LED on your Navio2 board blinking yellow. If not (the LED stays constant) and you are sure the compiling does not yield any error, then it’s likely that your Ardupilot version does not work with Navio2.
To terminate the Ardupilot process, simply press Ctrl+C from your terminal.


References

  • https://ardupilot.org/dev/docs/building-for-navio2-on-rpi3.html
  • https://docs.emlid.com/navio/common/ardupilot/building-from-sources/
  • https://docs.emlid.com/navio2/common/ardupilot/installation-and-running/

Was this post helpful?

Leave a Reply

Your email address will not be published.