Shop OBEX P1 Docs P2 Docs Learn Events
Need some guidance on implementing Navigation using GPS Module w/ Prop — Parallax Forums

Need some guidance on implementing Navigation using GPS Module w/ Prop

ALIBEALIBE Posts: 299
edited 2007-09-15 13:19 in Propeller 1
hello folks
I know this subject has been brought up by a few in the past - but, I could not find a trace via http://search.parallax.com/ site.

Let me state the problem:
  1. I have Point A pA and Point B pB and I have coordinates for both of these (lat/lon)
    1. I do not have a pre-recorded trail of coords btwn pA and pB - all I have is pA and pB coords
  2. Now, assuming there's clear line of site btwn pA and pB (no obstacles), I would like for my robot to travel from pA to pB.

Assuming I'm heading North from pA toward pB (pB is north of pA let's say)· I would like to understand:
  • how to stay on track to pB.·
  • that is, if i turn left/right, forward/backward, what effect will it have on current lat/lon.· I could write an app to figure this, but, wanted to ask this grp ahead.

or any other reading material on this navigation topic that is written in simple, easy to follow text.·

I know, I am asking for too much [noparse]:)[/noparse]

thanks in advance

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"any small object, accidentally dropped, goes and hides behind a larger object."

·
ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-08-20 22:00
    I am not sure I understand your problem.. Is it switching co-ordinate systems? Spherical trigonometry? Or just general information about WGS 84?

    When working with small distances (say: some miles) you can easily use flat co-ordinates (unles you live near one of the poles i.e.):

    Define your point A as (0,0) (WGS : longA, latA)
    Now where is B? (WGS: longB, latB)

    Well the vertical distance is just (latB-latA)*111,111 m
    The horizontal distance is (longB-longA) *111,111 m * cos((latB+latA)/2)

    Polar co-ordinates around the actual position "C" of your robot might even be more useful...

    There are thousends of pages about such transformations. It is basic stuff for every sailer...
  • ALIBEALIBE Posts: 299
    edited 2007-08-20 22:11
    thanks deSilva
    i guess i am not asking my ?n correctly. What I am really looking to understand is using pA and pB coords, how will i steer a robo from pA to pB assuming there's no obstacles btwn the 2.

    thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "any small object, accidentally dropped, goes and hides behind a larger object."

    ·
    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-20 22:13
    alibe: try this phrase: "dead reckoning" with the link above
  • ALIBEALIBE Posts: 299
    edited 2007-08-20 22:20
    thanks Fred - will do

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "any small object, accidentally dropped, goes and hides behind a larger object."

    ·
    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot
  • ALIBEALIBE Posts: 299
    edited 2007-08-21 03:08
    have not found any meaningful threads that point to this topic or related.· what am i missing guys

    thanks in advance

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "any small object, accidentally dropped, goes and hides behind a larger object."

    ·
    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-21 03:38
    try 'dead reckoning gps' in google without the parallax limit: http://www.gpsworld.com/gpsworld/article/articleDetail.jsp?id=154870&pageID=6
    is the first one.
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-21 07:27
    As you know your precise position (the robot has the GPS receiver, doesn't it?) this not a matter of "dead reckoning".
    It is a matter or determining your "course", which is straightforward done with polar co-ordinates
    and also in Cartesian co-ordinates (just a small ATAN2 call!) , where for I gave you the transformation.

    I still don't understand the Question... You just have to "head" to that "course" and stop when you are there!

    Post Edited (deSilva) : 8/21/2007 7:37:11 AM GMT
  • Franz AchatzFranz Achatz Posts: 140
    edited 2007-08-21 07:52
    doesn't he need the combination GPS and Compass ???
    I think a Compass is needed, too, because when he starts up his robot the Robot needs
    to know in which direction to move.

    Franz
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-21 11:06
    Right Franz, maybe that brings us to the problem. So the Robot has to move,
    check its new position to determine the direction it has moved, and update his course!
    Looks like PID smile.gif
  • Franz AchatzFranz Achatz Posts: 140
    edited 2007-08-21 11:21
    right, this could be done in two ways:

    a) like deSilva posted by only using a GPS module
    But note: when starting up your robot he will/can move in the wrong direction a bit

    b) adding a Parallax Compass module
    Note: the robot will go at startup directly to the right direction but it costs an extra module

    Franz
  • ALIBEALIBE Posts: 299
    edited 2007-08-21 13:36
    thanks all for the input this far.· (I have a Parallax Compass and a GPS module).

    The struggle I am facing is determining the course and how I would use the heading data (compass) and lat/lon data (GPS) to determine which way to go.

    I should do some reading and experimenting before I can ask my ?s intelligently [noparse]:)[/noparse].· So, I shall go do that now and circle back w/ more info in my pocket

    thanks guys - appreciate your help thus far and for patience while I wander about my clouded ?ns

    Nagi

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "any small object, accidentally dropped, goes and hides behind a larger object."

    ·
    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot
  • Franz AchatzFranz Achatz Posts: 140
    edited 2007-08-21 14:49
    Hi Alibe,

    i found something nice for you.
    A project for a "robot GPS/Compass Navi" at the elektor magazine.
    Its written in BASCOM AVR for an ATMEGA32 but i am sure you can convert
    it for the Propeller. The bad thing is that most of the sourcecode is written in german.

    You have to register at this site for a free download:
    http://www.elektor.com/magazines/2007/july-august/satnav-for-robots.197653.lynkx

    have fun
    Franz
    ·
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-21 14:53
    Curious: what's the resolution of this gps value? I get the feeling we're not talking about navigating a living room.
  • Kaos KiddKaos Kidd Posts: 614
    edited 2007-08-21 15:10
    Ummm, Just my .02 cents worth... Ok, maby .05 with inflation.
    To start with:
    · For any autonomous object to move from point A to Point B, three things must be known:
    1. The current location
    2. The current direction
    3. The direction needed to go in.
    ·
    Ok, you have #1, POS A in your post.· You can calculate #3 using the formulas described above, so now all you need is the starting direction.· Others have already led to this point, but I’ll try to bring it into something somewhat “closer”.
    ·
    1. Get your current location and current heading.
    2. Convert the destination to a direction from current heading.
    3. Turn until you are facing the correct heading.
    4. Move a small amount in the correct heading.
    5. If you are NOT at your destination then go to step 1
    ·
    The GPS can be used to generate a heading.· The issue in using a GPS to generate your current heading is that you must move a distance.· And that distance HAS TO BE greater then the resolution of the GPS, and there is slew in the measurement.· Where as a simple compass can be used to return your heading immediately, with very little slew in the reading.· To keep things in line, and to compensate for slew in the heading, and any slew in the long/lat conversations, I would travel in small steps, constantly running through the above loop.
    ·
    Ok, thanks for reading… I hope it helps…
    ·
    KK

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd

    ·
  • crgwbrcrgwbr Posts: 614
    edited 2007-08-21 15:38
    gerally about + or - 15 feet

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Blog: Prog | Electro | Mech

    I would love to change the world, but they won't give me the source code

    People say that if you play Microsoft CD's backwards, you hear satanic things, but that's nothing, because if you play them forwards, they install Windows.

    I spent a minute looking at my own code by accident. I was thinking "What the heck is this guy doing?"
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-21 15:55
    crgwbr said...
    gerally about + or - 15 feet
    Even less! People are generally astonished when hearing this, as they have been told that (commercial) GPS has an inaccuracy of 30 meters or so.
    But this is an ABSOLUTE error only. A small displacement within some minutes can be meassured very exactly! This is the way a GPS compass works.
  • APAP Posts: 24
    edited 2007-08-24 00:55
    Here is what I do:

    1) Memory contains Lat/Lon of target location
    2) GPS provides actual Lat/Lon
    3) Calculate DeltaLat and DeltaLon from actual to target - this is the X and Y on a unit triangle.
    4) Calculate distance to target by pathagorean theorom: distance = sqrt(Lat^2 + Lon^2), but realize also that Longitude gets "compressed" the farther you are from equator, so you have to first correct DeltaLon to be same relative size as DeltaLat by multiplying DeltaLon by the cosine of actual latitude. think through this. You might think "wait a minute! you mean divide by Cos(lat), but I assure you it is multiply. Waaaay up near North pole, going East only a few miles might be quite a few degrees East of longitude. you have to chop down the highly inflated DeltaLon.
    5) If distance to target WP is less than some tolerance (lets say 50 feet), then you have to update the the coordinates in RAM to the next set of targets and loop back to #2, otherwise proceed to step 6.
    6)ATAN calculation to get required heading to pursue for the craft to hit target. Realize the "heading" is zero at North and increases as you go clockwise, whereas cartesion coordinate system (and ATAN) would be zero at East and increases as you go counter clockwise). To convert cartesion angle to heading do this: Heading = 90 - Angle. This inverts the sign and corrects the 90 degree difference. an assumption here is that East is positive, and North is positive. For example, if the target is North and East of you, the cartesion quadrant is I, and the required angle will be somewhere between 0 and 90, or calc'd as a required heading would be between 90 and 0. If the target is North and West of you, then that's cartesion quadrant II, and angle is between 90 and 180, required heading between 270 and 360 (well, it's actually called zero heading). Get my drift?
    7) GPS provides current heading (you don't need a compass at all) as long as you are moving at least a couple km/hour (I have no problem at walking speed with the EM-406 or ETek EB-85A)
    8) calculate Delta heading between actual and required. E.g. I'm on a course of 45 degree heading, but to hit target I need to be 66 degree heading, therefore I need to steer +21 degrees Clockwise, then I'll be right on course.
    9) use some PID control of steering function to achieve DeltaHeading correction. (In PID the "DeltaHeading" is the error between actual and target)
    10) when next GPS data becomes available, iterate the entire process by going back to step 1.
  • APAP Posts: 24
    edited 2007-08-24 01:01
    Oh - also realize that there would be a conversion between units of angle and distance. that is why I use DeltaLat as-is and correct DeltaLon to match, because 1 minute DeltaLat is always 1 nautical mile or roughly 6000 feet. DeltaLon on the other hand, starts on equator as 1 minute = 1 nautical mile, but as you go away from equator 1 nautical mile becomes many minutes of angle.

    Also, DeltaLon is cartesian "X", and DeltaLat is "Y". Origin is the current position, and out on the unit circle is the target.
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 07:31
    Nice to hear you followed absolutely ALL recommendations given in this thread! This again proves the power of co-operations!
    Just BTW: It will simplify your program when you use ATAN2 - as I said - rather than ATAN.
  • ahanktcdahanktcd Posts: 8
    edited 2007-09-15 13:19
    Is there Spin code posted for receiving GPS data, possibly in a separate cog? I'd love to just start a GPS cog, and have it constantly update itself with new data. Then when my main program needs a 'fix', it just asks for it and the data comes from that cog's memory.
Sign In or Register to comment.