NAVIO: Installing and running APM (ArduPilot)
This document is not updated, please proceed to docs.blog.emlid.com for latest version!
It is possible to run APM (ArduPilot) on Raspberry Pi with Navio. The autopilot’s code works directly on Raspberry Pi using the APM’s Linux HAL. Even though it is possible to run APM on standard Raspbian distribution it won’t work properly as it requires lower latency. Please use Raspbian with real time kernel for running APM, you can get it here.
Important! Keep in mind that the code for Navio is in the experimental state.
Use it with caution!
State of the ArduPilot port to Raspberry Pi with Navio
These things were already supported in APM’s library and worked with minimal configuration:
- MPU9250 inertial sensor
- MS5611 barometer
- Serial port
What has been added:
- Raspberry Pi build configuration
- Navio board configuration
- GPIO driver for Raspberry Pi
- RCOutput based on PCA9685 with 24.576 external oscillator
- RCInput – uses pigpio daemon to sample GPIOs with 1MHz rate, should be rewritten to work without pigpio
- RGB LED
- MPU9250 built-in compass driver
- U-blox GPS SPI driver – ready, but requires some rework
- ADC based on ADS1115 – ready, needs reworking (available in navio-experimental branch only)
Installing APM
Log in to your Raspberry Pi using SSH or other method and download one of the ready to use APM binaries using wget.
For Navio or Navio+ pick one of the following corresponding to the type of your drone:
wget emlid.com/files/APM/Navio/APMrover2.elf wget emlid.com/files/APM/Navio/ArduCopter.elf wget emlid.com/files/APM/Navio/ArduPlane.elf
For Navio Raw pick one of the following corresponding to the type of your drone:
wget blog.emlid.com/files/APM/NavioRaw/APMrover2.elf wget blog.emlid.com/files/APM/NavioRaw/ArduCopter.elf wget blog.emlid.com/files/APM/NavioRaw/ArduPlane.elf
Make the file executable (if needed replace APMrover2.elf with ArduCopter.elf or ArduPlane.elf):
sudo chmod +x APMrover2.elf
If you’d like to build the binary yourself please proceed to the following tutorial.
Running APM
To run APM use the following (change APMrover2.elf to ArduCopter.elf or ArduPlane.elf if needed):
sudo ./APMrover2.elf -A udp:192.168.1.2:14550
Where 192.168.1.2 is the IP address of the device with the Ground Control Station – your laptop, smartphone etc.
Arguments specify serial ports (TCP or UDP can be used instead of serial ports) :
- -A is for telemetry
- -B is for external GPS
- -C is for secondary telemetry
If you would like to transfer secondary telemetry over the UART port on Navio you can specify it like this:
sudo ./APMrover2.elf -A udp:192.168.1.2:14550 -C /dev/ttyAMA0
Autostarting APM on boot
To automatically start APM on boot add the following (change -A and -C options to suit your setup) to /etc/rc.local file on your Raspberry Pi:
sudo /home/pi/APMrover2.elf -A udp:192.168.1.2:14550 -C /dev/ttyAMA0 > /home/pi/startup_log &
Connecting to Navio from the GCS
APM Planner
APM Planner is a ground station software for APM. It can be downloaded from the ardupilot.com
APM Planner listens on UDP port 14550, so it should catch telemetry from the drone automatically.
MAVProxy
MAVProxy is a console-oriented ground station software written in Python that can be used standalone or together with APM Planner. It’s well suited for advanced users and developers. MAVProxy can be installed with pip:
pip install mavlink mavproxy console wp
To run it specify the –master port, which can be serial, TCP or UDP. It also can perform data passthrough using –out option.
mavproxy.py --master 192.168.1.2:14550 --console
Where 192.168.1.2 is the IP address of the GCS, not RPi.
Hi,
The navio source doesn’t compile on the raspian RT image. Instead it generated load of error messages: ‘function’ was not declared in this scope.
Cross compiling in Ubuntu using the supplied arm compilers work fine but the resulting binary generates segmentation fault when attempt to execute in raspbian RT.
Any idea?
Hello Benny,
I’ve just tried to compile navio branch on Raspberry Pi and it was successful. Could you please post what you’re doing step by step and also provide the output?
ARM compiler that comes with Ubuntu does not produce correct armhf binaries for ARMv6 architecture that BCM2835 uses. Instead use compiler from Raspberry Pi Foundation that is available here – https://github.com/raspberrypi/tools. I’ll add this info to the tutorial.
When will ADC be fully functional?
We have an example how to read it as well as a tutorial. Driver for ArduPilot is scheduled after the core functionality.
Also I have a problem with getting GPS data on the APM mission Planner Side as it shows the 0,0,0 for the position. I could not be able to get it working.
1. Have you connected antenna to the connector on Navio?
2. Is antenna inside the building? Satellite reception in buildings is usually poor.
3. What is the GPS status in APM Planner?
4. Have you tried running the GPS example?
1. Yes. I have connected.
2. Yes, but it is near the window.
3. It is 0.00 and also the other variables about gps are also 0.00.
4. Yes I have tried running the example and it works like a charm. Founds the coordinates after a few iteration.
GPS support was added recently, please pull the newest changes and switch to branch navio-experimental
Hi Guys,
When I follow your guide I get this error:
pi@navio ~/Navio/APM/ardupilot/APMrover2 $ make configure
../mk/configure.mk:2: WARNING – A /home/pi/Navio/APM/ardupilot/config.mk file has been written
../mk/configure.mk:2: Please edit the file to match your system configuration, if you use a different board or port
pi@navio ~/Navio/APM/ardupilot/APMrover2 $ make navio
../mk/find_tools.mk:94: *** ERROR: cannot find gawk – you may need to install GNU awk. Stop.
I will see if I get awk installed.
This is with the latest realtime image.
hugo
## sudo apt-get install gawk
did the trick, build finished ok…
hi, i wanted to know if we can use navio APM for a drone in the current state of progress of this project. It’s been a while since the last update. any news ??? someone tried to make it work ???
Thanks
florent
Hi Florent, yes you can use Navio as an Autopilot. APM is still in testing, but fully functional.
Hello! I flew with NAVIO & Rasperry Pi.
This is my plane 🙂 http://hsto.org/files/925/eee/6af/925eee6af24d4390bb00b7720b3b920f.jpg