GPS configuration - clems4ever/ardrone_loclib GitHub Wiki
This page presents a solution to setup a communication between a serial gps chip (see note) and the drone, thanks to a USB-TTL cable.
We simply connect the GPS board to the usb-ttl cable and connect the cable to the drone. To make it work, you need to install some kernel modules. Please refer to the GPS integration page on this wiki first.
You can download sources on the other-sources
branch of this repo. This program presents some configuration options for the Pmod GPS board. You can change baudrate, change update rate,... You can print an help message with option -h:
this is a tool for communicating with Pmod GPS device
via serial - usb converter. It was developed for ftdi ttl 232R 3V3 chip,
but may work with other GPS devices and usb-ttl adapters
Option are:
-F <device> the device file (default is /dev/ttyUSB0)
-b set baudrate (9600 38400 115200) default is 9600 baud
-B N change GPS chip baudrate and exit N=[9600 | 38400 | 115200]
-r read communication and print to stdout
-h print this help message
-t test the GPS sending a null message, then read
-S put GPS in simple mode : only send GGA and RMC strings equivalent
to -o simple
-u N set update rate of gps fix [1 5 10] Hz
-o <mode> change output options of NMEA sentences. Possible options
are default, gga, rmc, rmc+gga, simple (equivalent to rmc+gga)
Note that to enable 5Hz or 10Hz update rate, you first need to select a baudrate of 38400 as minimum.
Each command should send an acknowledgment in the form $PMTK001,cmd,flag*chksum
. If flag is 3, all is OK.
By default the board communicates at 9600 baud with 1Hz update rate. Read the README for more information.
Simply compile the downloaded source with an ARM compiler (see GPS integration page on this wiki) with /opt/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc -march=armv7-a gpsUsb.c -o gpsUsb.elf
.
Upload the executable on the drone, don't forget to add execution rights (chmod +x gpsUsb.elf
)
Modify the launch.sh file created you created following the instructions in the GPS integration page so it looks like that:
modules_path="/data/video"
port_gps=4567
device="/dev/ttyUSB0"
insmod $modules_path/usbserial.ko
insmod $modules_path/ftdi_sio.ko
insmod $modules_path/cdc-acm.ko
sleep 2
#enable 38400 baud communication:
$modules_path/gpsUsb.elf -b 9600 -B 38400
#set simple mode and 5Hz update rate; you can change it to 10:
$modules_path/gpsUsb.elf -b 38400 -Su 5
nc -l -l -p $port_gps -e cat $device
Now, when you launch the drone, it will set the gps to communicate the position at 5Hz with only the basic information, i.e. only GGA and RMC messages. The launch script also starts a netcat to publish the data to port 4567 using tcp.
note: we had some faulty communication issues, so that the above script wasn't making it's job. We had to telnet the drone on each reboot. It would be interesting to check for ACK from gps chip.
######1: note on GPS chip choice The serial gps board we use is a Digilent board that features a GlobalTop Gms-u1LP GPS antenna module that utilizes the MediaTek GPS MT3329. This Pmod board enables easy UART communication. Still, we do not recommend this. A u-blox chip was recommended to us. Why? Because it might be more configurable. But we are satisfied with our current gps board.