Friday, May 20, 2016

RTK Rover Project Chapter 1: RTK and RTKLIB

Not long ago I posted about getting the Pre-GO PPP GPS modules up and running on BeagleBone Black with our Gumstix BBB Rover cape.  Now that I have them working on both this and the Gumstix Pi Compute Dev Board, it's time to take the GPS fun to the next level.  So what can we do with two incredibly accurate GPS modules running on tiny devices?  How about Real-Time Kinematics?

RTK eliminates the jitter experienced by solitary GPS receivers using differential techniques.  It requires a base station with known co-ordinates and a mobile reciever. By using the difference in signal-to-noise (SNR) ratios and phase for common satellites, RTK algorithms can cancel out atmospheric effects that can pollute geopositioning results.  I won't go into incredible detail here since Navipedia has a great wiki on the subject.
This image shows the GPS/GNSS data in pink and the RTK results in green of a rover driving around in a  6-meter circle.

So why do we care about RTK?  It's primarily used for surveying, but there are many situations when a robotic rover may want to track its path, report its exact position or navigate to a given waypoint with a high level of accuracy.  That's what I'm excited about.  I'm going to rig an automated robot with a BBB and Rover cape, use my RPCM rig as a base station and use the GPS data to control the rover.

First we have to get some RTK software up and running.  There aren't a lot of options for this in the open-source world, but the biggest name is RTKLIB.  It's not only an open source library, but it also includes a complete set of GUI and CLI apps to get you started.

Sadly, the GUI elements are written for Windows, so there's no chance of using them on the Pi Compute dev board, and I'll have to monitor operations from my laptop.  But the str2str and rtkrcv command line programs are the two most important elements of the software suite for my needs. these applications, and eventually their source code, will be the backbone of the RTK project.  The easiest way to compile these for ARM Linux is to download the source code onto your BBB and Raspberry Pi and compile them natively.  I ran into a little linking problem after I cross-compiled the applications on my PC and tried to run them on the COMs.  In the end, it was just far less hassle to go native.

Having set a precedent with the Gumstix Pi Compute Pre-GO PPP project, I felt I had to build a fancy box for my Gumstix BBB Rover.

I got the COMs equipped with their expansion boards, Pre-GO PPPs and antennas and wrapped up in a nice package.  With the RPCM being my base station, I used a Pre-GO PPP SMA so I could use a more sensitive antenna.  This will get me a more accurate fix on the rover's position.  The antenna I'm using is the Dominator AA.161 from Taoglas.  The BBB Rover has an on-board TI WiLink8 WiFi and Bluetooth modem that requires a u.FL antenna, and I'm using the Pre-GO PPP with the built-in antenna.

With the binaries and data files on the boards, I started experimenting, streaming data from the COMs to my laptop and trying to get a fix.  I tried a myriad of config files and, after some digging, I put together this file. The commands therein are transmitted to the u-blox NEO-7P on the PPP boards and instruct them to transmit tuples that are normally blocked across the UART channel.  These strings carry the phase data of the satellite signals which RTKNAVI, the GUI I use on my laptop, uses for RTK solutions.

After some trial and error, I began to see SNR data.  It looked something like this:

The top graph is the data from the BBB, and the bottom from the RPCM.  Each bar represents the SNR from a satellite.  In order to get a solution, the two computers have to be able to get a strong fix (shown as a colored bar) on several common satellites.  Unfortunately, the window in the office only provides half a constellation.  Not nearly enough for RTK... Barely enough for a single fix.
My little computers are getting their fix.  Tux is helping.

 Clearly, I need to get outside.  That'll have to wait until next week.  In the meantime, I'm all set up, apart from a battery pack for the BBB, to do some real testing.

NEXT TIME: The great outdoors, differentially.

Monday, May 16, 2016

Gumstix Pi Pre-GO PPP Project Chapter 5

I took my equipment to the tennis court yesterday and gathered some data.  When I arrived, I was saddended to discover that the two main courts were occupied so I went to the last one. Ten minutes at each of the eight corners I'd mentioned before  gave me quite a bit of data.  When I plot it on Google Earth, it looks like this:

OK so something's wrong.  First off, the orientation Google's image is clearly incorrect. Secondly, there's that tree!  It's covering the entire back-right corner!  I might be able to go again some other time, but let's make some observations first.  Looking at the inner corners, [LBS, RBS, LFS, RFS], the dimensions are reasonably correct.

What it looks like to me is that the court sits on a slope, which I hadn't considered to be a major source of error.  I had assumed that the courts would be level but, having been there for some time, they have most likely sunk in places and bubbled in others.  I may have had more luck had I acquired access to Wimbledon,  but the fact of the matter is I'm trying to measure exact distances with chunks of metal free-falling high above the earth and no fixed point of reference on a surface with random elevations.

Here is my conclusion for this project:  The Pre-GO PPP works beautifully with the Raspberry Pi Compute Module through the Gumstix Pi's UART breakout connection. It is able to measure GPS position with decimetre-level accuracy and sub-decimetre jitter.  However, measuring distances with sub-metre-level accuracy is next to impossible using GPS coordinates alone.

There are many reasons.  First off, environmental factors, such as trees and bridges will drastically increase dilution of precision.  Reason number two is explained above.  Lastly,  I can't seem to get enough court time to collect all my data points.

Clearly, a new strategy must be employed.

Up next: BBB Rover and RTK