This blog page is dedicated to the NavBoard of the AR Drone.
You can download an on-drone c program (source+compiled) to convert raw NavData into physical angle, rotation rate, height and temperature values.
Navboard Init
The following script starts the navigation board data stream without first starting & killing program.elf. The script has been tested on an AR.Drone with firmware 1.7.4 and 1.3.3 and navboard hardware version 0xc0. I.e. the reply to command 15 is 0xc0.
The stty command sets up the serial port. The gpio command switches the /RESET pin of the navboard to high, and the echo command instructs the navboard to start the data stream.
stty -F /dev/ttyPA2 460800 -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 -isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
gpio 132 -d ho 1
echo -en "\x01" > /dev/ttyPA2
After this initialization the following command gets a navboard data packet:
dd if=/dev/ttyPA2 count=1 bs=46 | hexdump -C
Navboard Data Packet
After the navboard has been initialized and acquisition has been started, it sends a 46 byte data frame every 5ms (200Hz) over serial port /dev/ttyPA2. The structure of a data frame is:
u16 size; // +0x00 Size of the following data (always 0x2C)
u16 seq; // +0x02 Sequence number, increases every update
u16 acc[3]; // +0x04 Raw data (10-bit) of the accelerometers multiplied by 4
u16 gyro[3]; // +0x0A Raw data for the gyros, 12-bit A/D converted voltage of the gyros. X,Y=IDG, Z=Epson
u16 gyro_110[2]; // +0x10 4.5x Raw data (IDG), gyro values with another resolution (see IDG-500 datasheet)
u16 acc_temp; // +0x14 Accs temperature -- startup value 120 @ 25C, rising to 143
u16 gyro_temp; // +0x16 XYGyro temperature (IDG), 12-bit A/D converted voltage of IDG's temperature sensor -- startup value 1532 @ 25C, rising to 1572
u16 vrefEpson; // +0x18 ZGyro v_ref (Epson), 12-bit A/D converted reference voltage of the Epson sensor
u16 vrefIDG; // +0x1A XYGyro v_ref (IDG), 12-bit A/D converted reference voltage of the IDG sensor
u16 us_echo; // +0x1C bit15=1 echo pulse transmitted, bit14-0 first echo. Value 30 = 1cm. min value: 784 = 26cm
u16 checksum; // +0x1E Checksum = sum of all values except checksum (22 values)
u16 us_echo_start; // +0x20 Array with starts of echos (8 array values @ 25Hz, 9 values @ 22.22Hz)
u16 us_echo_end; // +0x22 Array with ends of echos (8 array values @ 25Hz, 9 values @ 22.22Hz)
u16 us_association_echo; // +0x24 Ultrasonic parameter -- maybe echo number starting with 0. max value 3758. examples: 0,1,2,3,4,5,6,7 ; 0,1,2,3,4,86,6,9
u16 us_distance_echo; // +0x26 Ultrasonic parameter -- no clear pattern
u16 us_courbe_temps; // +0x28 Ultrasonic parameter -- counts up from 0 to approx 24346 in 192 sample cycles of which 12 cylces have value 0
u16 us_courbe_valeur; // +0x2A Ultrasonic parameter -- value between 0 and 4000, no clear pattern. 192 sample cycles of which 12 cylces have value 0
u16 us_courbe_ref; // +0x2C Ultrasonic parameter -- coutns down from 4000 to 0 in 192 sample cycles of which 12 cylces have value 0
Navboard Commands
The following lists the commands that can be sent to the navboard. The list is obtained from ARDrone_SDK_Version_1_7_20110525\ARDroneLib\Soft\Common\ardrone_common_config.h
ADC_CMD_STARTACQ = 1, /**command to start acquisition with ADC **/
ADC_CMD_STOPACQ = 2, /**command to stop acquisition with ADC **/
ADC_CMD_RESYNC = 3, /**command to resync acquisition with ADC **/
ADC_CMD_TEST = 4, /**command to ADC send a test frame (123456) **/
ADC_CMD_VERSION = 5, /**command to ADC send his number : version (MSB) subversion (LSB) **/
Example: reply to cmd 5 is 0x37 00 04 00 <--> version 4.37
ADC_CMD_SELECT_ULTRASOUND_22Hz = 7, /**set the ultrasound at 22,22Hz **/
ADC_CMD_SELECT_ULTRASOUND_25Hz = 8, /**set the ultrasound at 25Hz **/
ADC_CMD_SEND_CALIBRE = 13, /**command to ADC to send the calibration **/
ADC_CMD_RECEVED_CALIBRE = 14, /**command to ADC to receved a new calibration **/
ADC_CMD_GET_HARD_VERSION = 15, /**get the hard version of the navboard **/
Example: reply to cmd 15 is 0xc0 <--> version 11.0
ADC_CMD_ACTIVE_SEPARATION = 16, /**enabled the separation of sources ultrasound **/
ADC_CMD_STOP_SEPARATION = 17, /**disables the ultrasound source separation **/
ADC_CMD_RECEVED_PROD = 18, /**command to ADC to receved the prod data **/
ADC_CMD_SEND_PROD = 19, /**command to ADC to send the prod data **/
ADC_CMD_ACTIVE_ETALONAGE = 20, /**command to ADC to send PWM ultrasond in continue **/
ADC_CMD_ACTIVE_ULTRASON = 21, /**command to ADC to stop send PWM ultrasond in continue **/
ADC_CMD_ACTIVE_TEST_ULTRASON = 22, /**teste de la perturbation de l'ultrason par le wifi **/
Navboard Connector Pinout
1 : +Vcc (5v)
2 : PGED2/RP10(1)/CN16/PMD2/RB10 (8) (ICSP) <--> GPIO 130
3 : Txd (to Navboard)
4 : PGEC2/RP11(1)/CN15/PMD1/RB11 (9) (ICSP) <--> GPIO 131
5 : Rxd (from Navboard)
6 : /MCLEAR (18) <--> GPIO 132
7 : GND
8 : GND
References
http://embedded-software.blogspot.com/2011/01/reading-navigation-data-directly-from.html