Paparazzi Autopilot for Linux
This project has been inactive since I left Rutgers in July 2010. I currently contribute to the ArduPilot Project. -pat
The Paparazzi project is a complete hardware and software solution for controlling model aircraft. It is a large and mature open source project with a successful user community. The Paparazzi project has developed microcontroller-based autopilot hardware, the latest release of which is the Tiny v2.
While the Tiny is very capable as a standalone autopilot, we wanted a system that would be easier to integrate with a Linux based camera system, and could be built with off the shelf hardware.
Bradley Lord and I ported the Paparazzi autopilot code from the Tiny 2 hardware to Linux. Using an off the shelf single board computer and USB devices, we've duplicated the functionality of the Tiny with the exception of PPM input. The current state of the project is a very bare port of the Paparazzi airborne code, but we're working to improve the compilation system and make Paparazzi a better Linux citizen.
We currently have the Paparazzi airborne code running using the following hardware:
- A Beagleboard running Angstrom Linux. The Beagleboard features a 500MHz ARM Cortex A8 processor, an 8GB SD card, and 256MB ram. The autopilot process takes up about 5% of the processor, leaving plenty of room to develop applications.
- A GS407 LEA-5H based GPS.
- A Pololu Micro Maestro Servo Controller for servo output, and a Pololu 4 Servo Multiplexer to support a failsafe radio.
- A thermopile-based attitude sensor, built using an Arduino.
- Both 802.11 and Xbee Pro datalink and telemetry.
This project is still in development, and is probably unsuitable for use without some major work. If you'd like to make use of the code, it is released under the same GPL2 License as the Paparazzi project.
The following features are in progress:
- Integration with gpsd, replacing the UBX parser code and direct IO with the gps device. Gpsd supports a wide variety of gps units and allows multiple applications to access the latest gps information.
- A 3-axis Magnetic, Accellerometer, and Rate Gyro based attitude-heading sensor
Images - Click to Enlarge
We're currently using a 60 size trainer borrowed from our flight instructor (Thanks Larry Kosinar of Tri-County RC Club) as the autopilot test bed. We'll be moving to a 10ft wingspan plane soon for Rutgers University's entry into the 2010 AUVSI UAS Competition.
Left to right: voltage regulator, Pololu servo controller and mux with Futaba 2.4GHz receiver, Beagleboard flight computer, Ublox LEA-5H based GPS with Sparkfun FTDI adapter, Xbee Pro 2.4Ghz modem with Sparkfun Xbee Explorer adapter.
Thermopile-based attitude sensor, mounted to fuselage. The analog amplification circuit is located on each sensor, so they are simply plugged into an Arduino's ADCs to communicate with the computer.
The beagleboard is packaged for flight in an anti-static bag, wrapped in foam rubber. Only power, RS232, and a single USB port are used.
System schematic: view bigger as image, pdf.
Powered Belkin USB hub located in rear of fuselage, along with Hawkins wifi adapter. GPS is velcroed to fuselage ceiling and Xbee is velcroed to fuselage floor. The wifi adapter and Xbee have separate RP-SMA 2.4Ghz antennas on 30cm extensions so they can be located at opposite ends of the plane.
The rear of the plane with all devices installed. We isolated everything we could in foam rubber for vibration resistance.
Front of fuselage, top view: flight computer sits alongside 1500mAh 11.1v LiPo battery in front of the servo tray. The R/C receiver and servo output electronics are located underneath.
Everything packed in and running: Thinkpad is running Paparazzi ground station, Acer is logged into flight computer over wifi running top.
Making use of this code:
You can download the latest release at github. Please contact us if you have interest and want to follow our progress or submit changes.
You'll want to go to the Paparazzi wiki and follow their installation instructions. If you're using Ubuntu as your development machine (we are) make sure you install the paparazzi-dev and paparazzi-arm7 packages, as both are needed to build the source tree. (We're not using the -arm7 packages or any cross compiler - c code is compiled natively on the flight computer.)
Clone our git repository and set your PAPARAZZI_HOME and PAPARAZZI_SRC variables to point to it. It based off the Paparazzi svn trunk rev 4543 (05 Feb 10). We haven't integrated our changes back into the subversion tracking system because we don't use subversion, and we made enough changes to the files in sw/airborne that it won't be compatible with the trunk any more. We removed a lot of extraneous files to keep the download size small, so you may want to check out what the trunk offers as well.
Familiarize yourself with the following directories and configuration files. Our changes have been made to the trunk in these places:
- conf/airframes/linuxfc.xml contains all of the definitions and the list of sources our project uses. It isn't too different from a Tiny conf file.
- sw/airborne/linux-native is where we have made the majority of our changes:
- We've rewritten sw/airborne/main.c, sw/airborne/main_ap.c (as ap.c) and sw/airborne/main_fbw.c (as fbw.c) in order to remove support for all of the features we don't need.
- Analog input from thermopile sensor: adc_hw.c launches a helper thread that opens ADC_PATH as a tty device at baud ADC_BAUD and reads NMEA style sentences which give the value of the input channels. The helper thread inserts these values into struct adc_buf* buffers, so the configuration of the thermopile sensors in linuxfc.xml works just like it does on the Tiny.
- We've provided the Arduino code which takes the analog readings in linux-native/adc_arduino for reference.
- Servo output: servos_hw.c opens POLOLU_PATH (the first virtual serial port that the Pololu Micro Maestro enumerates) and talks to the device using the Mini SSC protocol. To use the Mini SSC protocol you'll need to configure your Maestro with servo end points and failsafe values.
- Uart Interface: uart_hw.c provides an implementation using tty devices and a ring buffer which gives a serial port or USB to serial adapter same interface as a UART in the Tiny. It uses the UART#_FNAME and UART#_BAUD variables for UART1 and UART2.
- Makefiles: in the project root, Makefile includes Makefile.portable which defines the system for copying only the necessary c code into export/ for transfer to the flight computer. This eliminates the need for Ocaml or any of the paparazzi-dev packages on the flight computer; it should be enough to have gcc and make. Right now, we reccomend that you test changes to all configuration and c files locally with make AIRCRAFT=LINUXFC ap.compile. Once you have a working build, make AIRCRAFT=LINUXFC ap.upload calls make upload at the root directory. You can define an apporiate upload script in Makefile.portable. We use rsync to send the latest c files to the flight computer.
- conf/autopilot/linuxfc.makefile specifies the linux-native directory as part of the build path.
- conf/Makefile.linux-native is used for local builds, which we use to test the program before loading it onto the flight computer.
- conf/autopilot/linuxfc.h specifies the mapping of ADC_# macros to AdcBank0(#).