GPS madness
May 28
Uncategorized Comments Off
I decided that this holiday weekend I would try to get a head start on the autonomous vehicle project by learning a little about how GPS works. Reading the GPS data was easy enough thanks to my GPS stick, which outputs data to the PC through a virtual serial port as nicely formated NMEA 0183 sentences. I was pleasantly surprised to find that heading data is transmitted as part of the NMEA standard, which made it easy to write up a quick script to read GPS data.
To get the ball rolling, I wrote a dirty little python script that allowed me to enter a set of destination coordinates (manually via variable) The script would then guide me to the destination by outputting strings to the console such as “Turn left 46 degrees.” When I reached the destination waypoint, the script indicates that fact and exits.
While I’m certain that I won’t be winning any awards for my coding effort, I was very happy to have some working code that is actually able to determine how far I must turn in either direction, using the shortest route possible, to reach my destination.
Of course, there are some inherent problems when using the heading information from GPS. Namely, the vehicle must be in motion to register heading – and sometimes the heading information did not seem to be reflected quickly enough during sudden changes of direction. I can’t be sure how much of an issue this will really be until I can test it in the car. I may have to consider getting a compass module, although from what I understand they have some inherent complications of their own, most notably the fact that the GPS device points to true north, whereas a compass will point to magnetic north.
I’ll keep you posted.
RSS