First flight of Linux APM on Raspberry Pi 2 with Navio+

3689643089?profile=original

Hey guys!

Today we’ve made the first flight of Linux APM on Raspberry Pi 2 with Navio+.

Navio+ is an autopilot HAT that includes all the necessary sensors: U-blox M8N GPS/Glonass/Beidou receiver, MPU9250 3-axis gyro, 3-axis accelerometer and 3-axis magnetometer, MS5611 barometer, ADS1115 16-bit ADC for battery monitoring, PCA9685 PWM generator and an RGB LED.

Raspberry Pi 2 is a new quad-core version of the most popular single board computer in the world. It was clear that APM would benefit from higher processing power and as Raspberry Pi Foundation decided to stick to the HAT standard for their boards, Navio+ fits and works perfectly without any hardware modifications.  

How does it compare to the good old Model A+/B+? According to the benchmarks made by David Hunt RPi2 gave us about 7 times higher performance.

3689643261?profile=original

For real-time performance we fly on PREEMPT_RT patched kernel only. This time, compiling a stable kernel turned out to be quite a challenge. Raspbian for RPi2 is based on Linux 3.18 and at the time of release there was no RT patch for that version. Luckily patch came out just two weeks later, but there were some issues with the USB driver, so we had to spend some time to investigate and fix those. Finally, after everything was solved and after long nights of stress testing we took it for a flight test today.

3689643186?profile=original

Despite the strong wind copter behaves nicely, loiters steadily and overall is a lot of fun to fly.

New Raspberry Pi 2 gives clear advantages over the older model, we are able to run main loop at 400Hz without missing a single cycle.  This is what your PERF will look like if you fly RPi2:

O96_fUfZBnyhpe9FZnu7VSU-GH6bYyBo4Ys4v6GbS__jxdHGR44jXR9SzfjWMZo2pSlQlFox6BouRMH_cJbAYre3zrAYYlvducZ1oSXdngcoGVpg40426egys9bGUTElrfugh2o?width=624

Today Emlid team celebrates its first birthday, a year ago we have started the Navio project with an idea to fly on Linux. I would like to thank everyone who worked with us through this year and made all this possible. Special thanks go to our team members who work hard, but do not usually show up as authors of blog posts: Georgii Staroselskii, Egor Fedorov and Vlad Zakharov.

You can get a Navio+ here :)

Have a great weekend!

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Sure!

  • Thanks for sharing this.  Exciting stuff!  

    With the Navio+ board on, is it possible to have a pi camera plugged in to the pi2?

  • I went with the RasPi because Emlid has the image for it and I could not wait for the C1.  The RasPi 2 is pretty fast and runs everything OK.

  • Hey Steve Buddy

    Just got my Navio in the mail at home today as well...but now I'm in Germany so I can't play with it! Why did you go with the RasPi 2 instead of the odroid C1 this time? We should catch up one day again for a fly once I'm back.

    Regards

    JB

  • Been smacked over the head with the obvious stick and of course the IP address for communication should be 127.0.0.1

    This line should be:

    sudo ArduPlane -A udp:127.0.0.1:14550 -C /dev/ttyAMA0 > /home/pi/startup_log

    and

    python /usr/local/bin/mavproxy.py --master=127.0.0.1:14550 --logfile=/home/pi/mav.tlog --out=192.168.1.10:14550 --out=113.212.169.23:14550

    In my case MavProxy is doing all the distributing of telemetry

  • Have got my Navio+ running on a RasPi2.

    1. It runs in screens perfectly well

    2. It runs MavProxy so you can do DroneAPI for cool stuff.

    Screens is a way of running processes in the background and be able to interact with them.  If you just background them with the & modifier then you can't really get to them easily to see what is happening.  This way I can switch to MavProxy that is running in the screen and enter commands.  It basically means I have a GCS on the RasPi.  It also means you can run DroneAPI on the RasPi and it talks directly to the Navio+

    This is my rc.local

    sudo -u pi screen -d -m -S 3G
    sudo -u pi screen -S 3G -p 0 -X exec /home/pi/start3G.sh
    sudo -u pi screen -d -m -S Navio
    sudo -u pi screen -S Navio -p 0 -X exec /home/pi/startNavio.sh
    sudo -u pi screen -d -m -S MavProxy
    sudo -u pi screen -S MavProxy -p 0 -X exec /home/pi/startmavproxy.sh

    The command sudo -u means that it runs as user pi so when you login as pi and switch to the screens they are there for you to look at instead of for the root user which would happen if you left out the sudo command

    start3G.sh

    #!/bin/bash

    sudo ./home/pi/sakis3g USBINTERFACE='0' OTHER='USBMODEM' USBMODEM='12d1:1c05' APN='CONNECT' CUSTOM_APN='CONNECT' APN_USER='0' APN_PASS='0' connect

    startNavio.sh

    #!/bin/bash

    sudo ArduPlane -A udp:192.168.1.28:14550 -C /dev/ttyAMA0 > /home/pi/startup_log

    192.168.1.28 is the IP address of the RasPi

    startmavproxy.sh

    #!/bin/bash
    python /usr/local/bin/mavproxy.py --master=192.168.1.28:14550 --logfile=/home/pi/mav.tlog --out=192.168.1.10:14550 --out=113.212.169.23:14550

    The --master statement takes the UDP packets from the Navio and starts up MavProxy.  The --out is for the ground station that is connected via wifi and if 3G is working the other IP address is the fixed IP address of my 3G connection on the ground.

    The only problem is when I use 3G and the RasPi does not have an IP address from the ethernet port and I don't think it will work.  I will have to find some way of changing it depending on what is connected.

    Now to fly the Penguin with it when my digital airspeed sensor and power module arrive.

  • @Emlid

    I have not change rc.local at all by file permission.

    It is OK now by direct editing "sudo vi".

  • @Jiro Hattori

    Could you please describe the problem with software start in details on our forum - http://community.emlid.com

    It's okay to simply unplug the power from Raspberry. 

  • @Emlid

    Plan to fly on Quad copter.I have few things to clear prior on the deck.

    1) I need to start the APM software, but failed. Could you elaborate "/etc/rc.local" file in detail ?

    2) What do you think about shutdown procedure of raspberry pi ?

        - Just unplug the cable

        - always hold PC and open console

        - prepare hardware shutdown button, and so on.

  • Jiro Hattori, congratulations! What are going to fly with it?

This reply was deleted.