Shop OBEX P1 Docs P2 Docs Learn Events
New to GPS and have many questions. — Parallax Forums

New to GPS and have many questions.

MarkSMarkS Posts: 342
edited 2010-12-19 19:52 in Accessories
OK, first, the back story. I am a transit bus driver in Oklahoma City. Sadly, the agency is rather small and underfunded. Back in 1990, the Americans with Disabilities Act was passed and it mandated many changes to how transit buses operate. One of the mandates was that all time points and points of interest along the route must be called out. Larger transit agencies purchase annunciators that are programmed with all of the points recorded in some audio format and tied with a GPS receiver, everything is called out automatically through the bus' PA system. Naturally, those systems are many thousands of dollars per unit and retrofitting our buses would cost the agency millions.

I HATE calling out stops. So, I got to thinking and realized that I could make a small and simple annunciator for my own use with the electronics knowledge I have. The one problem is that I have never tried to interface with a GPS module and I know nothing about what data I would get, nor how to make this work.

Basically, along the route would be various "GPS points" (for lack of a better term) stored on a flash card. The microcontroller would poll the GPS module and compare the data with the pre-programmed points along the route. When the bus gets within X feet/meters of a GPS point, the appropriate sound file(s) would be played.

Herein lies the problem. I do not know how to get the GPS points along the route to program into the route file. I do not know what type of data GPS modules outputs, and how it corresponds to real world locations. I do not know how to compare the stored points with the current GPS data to determine distance from the stored points.

I've gone over some GPS module data sheets, but they are really written with a knowledgeable user in mind. I really need a crash course in GPS modules and interfacing. Where can I find such information?

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-12-19 11:48
    GPSs output ASCII, 4800 8N1, that's the NMEA standard. The output strings are called 'sentences'. They output sentences once each minute. The coordinates are included on nearly every sentence. There are several sentences, each has unique data. Every sentence begins with "$GP" and has another three characters unique to each sentence; that's how you slect the appropriate sentence
    Taking in the data is easy.
  • MarkSMarkS Posts: 342
    edited 2010-12-19 12:04
    This much I knew. However, how do I compare the data and get a distance between points? For instance, a GPS receiver will output coordinates as longitude and latitude (found in Parallax' GPS receiver's manual). However, this does not help me much. Let's say that I want the device to respond to a radius of 2 meters. How do I calculate this with the stored longitude and latitude and the longitude and latitude that the receiver is outputting? Longitude and latitude give position, but not distance.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2010-12-19 13:01
    Oklahoma City is around N 35.46756 and W -97.51643. The last digit represents about 2 meters (1.85, more exactly). You wouldn't want to rely on that accuracy, but it would probably be safe to trigger the announcement within say 30 or 40 meters of the set point. You didn't say which processor you would be using, but suppose that you have loaded the number of minutes*1000 into variables, so in the above example you would have lat=46756 and lon=51643. Then you have to compare those values with the setpoints in memory. There are various processor specific ways to store those setpoints, but at the end it will come down to a comparison:
    ' PBASIC syntax
    ' latsetN, and lonsetN are the Nth set points
    '  threshold is something like 20, which respresents about 40 meters
    IF ABS (lat - latsetN) < threshold AND ABS ( lon - lonsetN < threshold) THEN 
         GOSUB announceN
    ENDIF
    
    That puts it within a rectangle around the set point. If you want a circle, well, you will have to do a little fancier math!
  • MarkSMarkS Posts: 342
    edited 2010-12-19 13:46
    but it would probably be safe to trigger the announcement within say 30 or 40 meters of the set point.

    That would be problematic. Let's use a cross street as an example. The route travels down street A (inbound and outbound) and intersects street B (a time point). There would be two set points here, one on the inbound side of the street and one on the outbound side, both a good distance from the actual intersection to give people a chance to respond to the annunciator. The issue with such a large range is that the time point would be called out when the bus gets within range of the first set point and then again when it gets in range of the second, since most city streets are less than 30 meters wide. Such a large range would cause problems even on cases where the route travels on the service road on one side of a six-lane highway inbound and the other side outbound. A 30 - 40 meter radius is a massive amount of space.

    The radius of the set points needs to be no more than the width of a standard lane on a two-lane street, or about 3 meters.

    This image shows part of an actual route and time point:

    mapsax.jpg

    With a 30 meter radius, the annunciator would trigger prior to May Ave, and then again, after May Ave. This can, of course, be taken care of in the source code, but this get tricky as city streets do not always make sense. A loop, for instance, would wreck havoc with the system.

    Franklin wrote: »

    Thanks! That does help a lot!
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2010-12-19 16:07
    I know what you mean; our car's Nav system becomes hopelessly confused among the twisted little streets above the UC Berkeley campus.

    Your advantage is the prescribed route, and the table of way points and announcements should occur in a certain sequence. (Although, expect unmarked obstacles--manual override!!)
  • ercoerco Posts: 20,255
    edited 2010-12-19 19:52
    Per Tracy's inference, perhaps start with the manual override: make an automatic announcement system that you manually trigger by pushbutton. This could be as simple as an MP3 player (most have voice recording) with the stops in sequential order. You can get that going pretty quick just to see how the passengers react to a recording. Then later add the GPS capability.
Sign In or Register to comment.