The robot is mobile, but let's not let it get lost. You're going to add a GPS receiver so that you can always know where you are.
As you let your device free, you may not only want it to know where it is, but also to have a way of finding out if it has made it to the desired location. One of the coolest things to connect to the robot is a GPS location device. In this project, I'll show you how to connect a GPS receiver to your robot and then use it to move in the correct direction.
In this project we will cover the following:
Connecting the BeagleBone Black to a GPS device
Accessing the GPS programmatically and determining how to move to a location
Unpack your GPS device; it is time to get started.
Before we get started, let me first give you a brief tutorial on GPS. GPS, which stands for Global Positioning System, is a system of satellites that transmits signals. GPS devices use these signals to calculate a position. There are a total of 24 satellites transmitting signals all around the earth at any given moment, but your device can only see the signal from a much smaller set of satellites.
Each of these satellites transmits a very accurate time signal that your device can receive and interpret. It receives the time signal from each of these satellites, and then based on the delay, the time it takes the signal to reach the device, it calculates the receiver's position based on a procedure called triangulation. The following two diagrams illustrate how the device uses the delay differences from three satellites to calculate its position:
The GPS device is able to detect...
Now that you can access your GPS device, let's work on accessing the data programmatically.
Your project should now have the GPS connected and have access to querying the data via the serial port. In this section, you will create a program to use this data to discover where you are, and then you can determine what to do with that information.
If you completed the last section, you should be able to receive the raw data from the GPS unit. Now you want to be able to take this data and do something with it, for example, find your current location and altitude and then decide if your target location is to the west, east, north, or south.
First, get the information out of the raw data. As noted earlier, our position and speed is in the $GPMRC
output of our GPS. First, write a program to simply parse out a couple of pieces of info from that data. So open a new file (you can name it location...
One of the ways to display positional information is to use a graphical display including a map of your current position. There are several map applications that can interface with your GPS to indicate your location on a map. Here is an excellent tutorial on this: https://www.sparkfun.com/tutorials/403. You won't need to execute the HW configuration part of the tutorial, but will be able to start with the section Read a GPS and plot position with Python.