I'm delighted to announce that the effort to port ArduPilot to Linux reached an important milestone yesterday with the first flight of a fixed wing aircraft on a Linux based autopilot running ArduPilot.
As I mentioned in a previous blog post, we've been working on porting ArduPilot to Linux for a while now. There are lots of reasons for wanting to do this port, not least of which is that it is an interesting challenge!
For the test flight yesterday I used a PXF cape which is an add-on to a BeagleBoneBlack board which was designed by Philip Rowse from 3DRobotics. The PXF cape was designed as a development test platform for Linux based autopilots, and includes a rich array of sensors. It has 3 IMUs (a MPU6000, a MPU9250 and a LSM9DSO), plus two barometers (MS5611 on SPI and I2C), 3 I2C connectors for things like magnetometers and airspeed sensors plus a pile of UARTs, analog ports etc.
All of this sits on top of a BeagleBoneBlack, which is a widely used embedded Linux board with 512M ram, a 1GHz ARM CPU and 2 GByte of EMMC for storage. We're running the Debian Linux distribution on the BeagleBoneBlack, with a 3.8.13-PREEMPT kernel. The BBB also has a two nice co-processors called PRUs (programmable realtime units) which are ideal for timing critical tasks. In the flight yesterday we used one PRU for capturing PPM-SUM input from a R/C receiver, and the other PRU for PWM output to the aircrafts servos.
Summer of code project
The effort to port ArduPilot to Linux got a big boost a few months ago when we teamed up with Victor, Sid and Anuj from the BeaglePilot project as part of a Google Summer of Code project. Victor was sponsored by GSoC, while Sid and Anuj were sponsored as summer students in 3DRobotics. Together they have put a huge amount of effort in over the last few months, which culminated in the flight yesterday. The timing was perfect, as yesterday was also the day that student evaluations were due for the GSoc!
PXF on a SkyWalker
For the flight yesterday I used a 3DR SkyWalker, with the BBB+PXF replacing the usual Pixhawk. Because the port of ArduPilot to Linux used the AP_HAL hardware abstraction layer all of the hardware specific code is abstracted below the flight code, which meant I was able to fly the SkyWalker with exactly the same parameters loaded as I have previously used with the Pixhawk on the same plane.
For this flight we didn't use all of the sensors on the PXF however. Some issues with the build of the initial test boards meant that only the MPU9250 was fully functional, but that was quite sufficient. Future revisions of the PXF will fix up the other two IMUs, allowing us to gain the advantages of multiple IMUs (specifically it gains considerable robustness to accelerometer aliasing).
I also had a digital airspeed sensor (on I2C) and an external GPS/Compass combo to give the full set of sensors needed for good fixed wing flight.
Debugging at the field
As with any experimental hardware you have to expect some issues, and the PXF indeed showed up a problem when I arrived at the flying field. At home I don't get GPS lock due to my metal roof so I hadn't done much testing of the GPS and when I was doing pre-flight ground testing yesterday I found that I frequently lost the GPS. With a bit of work using valgrind and gdb I found the bug, and the GPS started to work correctly. It was an interesting bug in the UART layer in AP_HAL_Linux which also may affect the AP_HAL_PX4 code used on a Pixhawk (although with much more subtle effect), so it was an important fix, and really shows the development benefit of testing on multiple platforms.
After that issue was fixed the SkyWalker was launched, and as expected it flew perfectly, exactly as it would fly with any other ArduPilot based autopilot. There was quite a strong wind (about 15 knots, gusting to 20) which was a challenge for such a small foam plane, but it handled it nicely.
Lots more photos of the first flight are available here. Thanks to Darrell Burkey for braving a cold Canberra morning to come out and take some photos!
Next Steps
Now that we have ArduPilot on PXF flying nicely the next step is a test flight with a multi-copter (I'll probably use an Iris). I'm also looking forward to hearing about first flight reports from other groups working on porting ArduPilot to other Linux based boards, such as the NavIO.
This projects follows in the footsteps of quite a few existing autopilots that run on Linux, both open source and proprietary, including such well known projects as Paparrazi, the AR-Drone and many research autopilots at universities around the world. Having the abiity to run ArduPilot on Linux opens up some interesting possibilities for the ArduPilot project, including things like ROS integration, tightly integrated SLAM and lots of computationally intensive vision algorithms. I'm really looking forward to ArduPilot on Linux being widely available for everyone to try.
All of the code needed to fly ArduPilot on Linux is in the standard ArduPilot git repository.
Thanks
Many thanks to 3DRobotics for sponsoring the development of the PXF cape, and to Victor, Sid and Anuj for their efforts over the last few months! Special thanks to Philip Rowse for designing the board, and for putting up with lots of questions as we worked on the port, and to Craig Elder and Jeff Wurzbach for providing engineering support from the 3DR US offices.
Comments
@Tridge/Phillip: On second thought, just leave a set of open holes so those of who don't have BBB's can link into the board. Taping out headers would make that cape a monster.
Congratulations guys and nice write up! One thing to watch out for with the BBB is that the HDMI seems to jam GPS. From memory I was using the stock Angstrom distribution with a 3DR uBlox6 GPS and had to disable the HDMI via uEnv.txt. You could even see a strong correlation between reported position accuracy and separation distance between the antenna and BBB.
@Tridge/Philip: If you are doing a board rev, consider taping out all three styles of(Pi/Beagle/Subset of Arduino R3) expansion header pads. Have the user add their own pin headers. An example of this with Pi/Arduino is here: (http://www.embest-tech.com/product/evaluation-boards/embedded-pi.html)
Because this (http://www.atmel.com/products/microcontrollers/arm/sama5d3.aspx) is just screaming to become the brains of a large-scale Ardupilot drone... The newer version has 2G of DDR2, 1G NAND Flash, 536MHz, and more ports than even I can think of what to do with.
Wow! Congratulations to all involved. Historic indeed!
How do actual loop times implemented on the BBB compare to those on the 168Mhz Pizhawk?
Awesome awesome stuff. Congrats to all involved.
Nice! I hope the cape becomes available for purchase someday!
Thank you Tridge and team for these pioneering efforts. You're making history: every linux based computer can now be converted into a drone controller!
Great work guys, after porting to Linux things could really speed up for sUAV FC's, safety, and usability.
I just bought Raspberry Pi, but i see BBB purchase is inevitable . PXF cape, is it going to be available to purchase?? When could it be????
This is really great Tridge,
It seems like you pretty much have the hardware interfacing issues hammered out in the Cape.
I know there was some talk of not producing the cape and simply incorporating all of the stuff from the BBB onto a new autopilot.
Personally I would very much like to see the Fire cape for the BBB produced as the BeagleBone itself is an excellent bargain to the community and is already incorporated in a ton of other projects.
I am also very much looking forward to an easier to use and more capable Linux development environment and I am sure it will encourage many new developers to contribute as well.
Personally I would like to see the BBB Fire Cape available as soon as possible.
I think this is a more versatile solution than a dedicated SBC like the $530.00 Erle board partly because you are forced into the standardized and widely used architecture of the BBB.
Best Regards,
Gary