Shop OBEX P1 Docs P2 Docs Learn Events
Autonomous GPS RObot — Parallax Forums

Autonomous GPS RObot

mitesh22mitesh22 Posts: 12
edited 2009-10-02 14:27 in Robotics
Hello guys,
This is Mitesh and Sajveev here from Chicago, working on our GPS robot!
Need some expertise from you guys, we are completely stuck at GPS programming, Untill so far I have used the manual for BS2 module and have designed Servo motors and Ultrasonic sensor.
Both parts of the robot works fine, servos are going back and forth according to the coding and ultrasonic sensor is sending out signal of 33 Khz frequency.
The resolution of the Ultrasonic sensor is 1.5 feet, so it would detect any obstacles and avoids it, now comes the part where we are lost.
We are also using GPS that should read the signal from satellite and find the co-ordinates where the robot is standing at first! We used the program given with the GPS to know how would that work, but how should we create out final point where the robot should go by itself. By the way the resolution for the GPS is 7.5 feet that means the every 7.5 feet the co-ordinates changes by 0.1 fractional minutes.


" border="0">
3264 x 2448 - 278K

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-09-02 01:39
    Here is some code that I wrote a long time ago to do what you (probably) want. It's pretty well documented, but it also probably has a bunch of bugs. YMMV. Anyway, you can use it for ideas.
  • mitesh22mitesh22 Posts: 12
    edited 2009-09-02 02:55
    Thank you SRLM for a very quick response, can you tell me why would I need to have the compass? Just curious!
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-02 04:43
    I didn't look at the code but I can tell you that you would want a compass to give you heading information. GPS can provide your heading but only while you are moving, once stopped the GPS has no idea what your heading is.

    Rich H
  • SRLMSRLM Posts: 5,045
    edited 2009-09-02 05:43
    Exactly. If you're absolutely sure that the robot will never stop then you can just replace the compass heading with the GPS heading. Note that GPS takes about 3 knots to get an accurate heading.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-02 16:14
    Mitesh22,

    In the future please confine posts on a subject to one forum. As of yesterday you had posted this subject in three forums and cross posting is not allowed. I have removed the message from the Completed Projects Forum. Thank you for your understanding. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • sailman58sailman58 Posts: 162
    edited 2009-09-02 16:29
    There is another thread that I started in this section titled "Robo Magellan". It was a request for more information on a robot using a Propeller chip which competed in the Chibots competition. Since you are in the Chicago area, you may be able to see his bot. Otherwise, you may be able to get something out of that thread.

    Ron aka sailman58
  • Rick BrooksRick Brooks Posts: 67
    edited 2009-09-02 21:38
    Mitesh22,

    I think that you are asking how to get the destination coordinates.· The technique would depend on your mission.· I plot a course in Google Earth and use the Google Earth coordinates to lay out the intermediate and final way points.· The way points are manually entered into the program.· This method requires fine tuning once you are at the location where you intend to run.

    I've seen others carry their robot around (or just the GPS unit from the robot) and use the GPS generated Latitude and Longitude to program the way points into the microcontroller.

    Once you have the destination programmed and the present location from the GPS unit, then you must calculate a heading (atan2 function) to the·waypoint and use your compass to navigate to the destination.· Of course you should be updating the heading with every new GPS reading.
    SRLM said...
    Note that GPS takes about 3 knots to get an accurate heading.
    The 3 knots·varies·between different·GPS units.··For example,·one unit that I used last year did not update at all under 7 knots.· It just repeated the last good Course Over·Ground.

    ···· Rick Brooks
  • mitesh22mitesh22 Posts: 12
    edited 2009-09-03 14:09
    I am looking forward to buy a compass and use it, and as far as the co-ordinates of the final point or wy point is concern, if I get something like 87 45 22.6 where 22.6 is the fractional minutes or the second part, when I enter it in BS2 it does not accept it!
    Is that because BS2 can not deal with floating numbers?
  • mitesh22mitesh22 Posts: 12
    edited 2009-09-03 14:10
    Chris
    Sorry about the issue of crossposting.
    Thank you
  • SRLMSRLM Posts: 5,045
    edited 2009-09-03 15:07
    No. BS2 does not support floating point.
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-03 17:08
    mitesh22 said...
    Is that because BS2 can not deal with floating numbers?

    Yeah, but there are ways around that. Attached is some code used for a GPS UAV, there is some sacrifice in resolution but that was acceptable for my use which required coverage for a large area. For your use you can probably make some changes to increase the resolution if you sacrifice the area that it will cover.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • jmbertoncelli@USAjmbertoncelli@USA Posts: 48
    edited 2009-09-03 21:42
    Well I think about a nice option that could work with all MCU... one could used the yM-FPU sold by Parallax. It is a 32 bit full floating point math IC with most of the math function available. One very interesting thing that I am currently testing is the possibility to connect the output of the GPS (raw NMEA data) directly to this math-coprocessor
    then the BS2 can call user function loaded to the yM-FPU to calculate whatever you need. By the way on the yM-FPU web site there is a very good example of user functions related to GPS calculation...

    jm.
  • SRLMSRLM Posts: 5,045
    edited 2009-09-04 02:06
    Note that a GPS usually gives you fixed point, which is much easier to work with than floating point.
  • jmbertoncelli@USAjmbertoncelli@USA Posts: 48
    edited 2009-09-04 19:37
    the uM-FPU is also designed to work with 32 bits integers.
  • jmbertoncelli@USAjmbertoncelli@USA Posts: 48
    edited 2009-09-04 19:38
    the uM-FPU is also designed to work with 32 bits integers and you can convert from float to int as well as int to float.

    jm.
  • mitesh22mitesh22 Posts: 12
    edited 2009-09-08 20:11
    Hey
    WG9FO,
    I looked at your code and seems almost same whar we have been trying for.
    I wanted to ask you something that when you created the waypoints why did you put your minutes like this:
    LatD01 CON 47 'Lat/Long entered in degrees then decimal degrees
    LatM01 CON 9474
    LongD01 CON 122
    LongM01 CON 2000

    Does that just to convert it from floating numbers to the integers.I mean when you use your GPS and it would show you that you are standing at 46.3 56.9 38.9 and all we are concerned is about the last part of that which is 38.9, so should I just multiply that with 10 and make it an interger number so it can work with BS2 module.?
    Looking forward to here from you.
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-08 22:11
    mitesh22 said...

    I wanted to ask you something that when you created the waypoints why did you put your minutes like this:
    LatD01 CON 47 'Lat/Long entered in degrees then decimal degrees
    LatM01 CON 9474
    LongD01 CON 122
    LongM01 CON 2000

    Does that just to convert it from floating numbers to the integers.I mean when you use your GPS and it would show you that you are standing at 46.3 56.9 38.9 and all we are concerned is about the last part of that which is 38.9, so should I just multiply that with 10 and make it an interger number so it can work with BS2 module.?
    Looking forward to here from you.

    Get_Long_Current:
      SEROUT Sio, Baud, [noparse][[/noparse]"!GPS", GetLong]
      SERIN  Sio, Baud, 3000, No_Response, [noparse][[/noparse]degrees, minutes, minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
    
      ' convert to decimal format
      workVal = (minutes * 1000 / 6) + (minutesD / 60)
    
      Dcurrent = degrees
      Mcurrent = workVal
    
    RETURN
    
    



    The above code converts the the degrees, minutes, decimal minutes format of the GPS into degrees and decimal degrees for use in the program. This results in a resolution of .0001 degrees or about 40 ft. Unless the area you are working in crosses a degree boundary all the math can be done on just the decimal portion which is word sized. Each coordinate will have 4 numbers - Longitude degrees, Longitude decimal degrees, Latitude degrees and Latitude decimal degrees. You can discard the whole degrees portion if it won't change for the course you will run.

    The Longitude decimal degrees is X and the Latitude decimal degrees is Y in the Cartesian coordinate system. This makes it easy to use ATN and HYP to find direction and distance to any other point on the grid.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • mitesh22mitesh22 Posts: 12
    edited 2009-09-11 02:56
    Thank you Rich
    The co-ordinates of the waypoints of my robot are,
    Latitude: 041 56 36.5 N
    Longitude: 067 41 28.9 W

    You said that the resolution of your code is 40 feet but in my case the GPS chages its values at every 7.5 feet and it changes to the change of 0.1 in seconds column that is the last value in above co-ordinates.

    How can I use these values to put in the BS2 module like you did by creating a waypoint like
    LatD01 CON 47 'Lat/Long entered in degrees then decimal degrees
    LatM01 CON 9474
    LongD01 CON 122
    LongM01 CON 2000
    ? please guide me thorugh
  • mitesh22mitesh22 Posts: 12
    edited 2009-09-15 22:05
    Hey Rich
    Here is my first way point Its co-ordinates are:
    Point 1

    latitude:41.944528 (41_56_40.3)
    longitude:87.689111 (87_41_20.8)
    In the bracket I have the deg, min, seconds) and the other values are the decimal values:
    Now how do I put these values in the code:

    LatD01 CON 41 'Lat/Long entered in degrees then decimal degrees
    LatM01 CON 944528
    LongD01 CON 87
    LongM01 CON 689111
    ?
    This would be my last question?
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-16 02:21
    Sorry, I am away from my computer and I haven't used that code in a couple years so I need some time to get familiar with what I was doing. I'll try to get back later today. If I forget, PM me.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-16 06:00
    mitesh22 said...

    LatD01 CON 41 'Lat/Long entered in degrees then decimal degrees
    LatM01 CON 944528
    LongD01 CON 87
    LongM01 CON 689111

    Okay first, the Basic Stamps can only have up to word size variables so the decimal portion of your latitude must be shortened to 9445. That is why the resolution using this program is only about 40 feet. It has nothing to do with the sensitivity of your GPS but the size of the variable we have to work with.

    I would rewrite the program to better suit your purpose. You could get by with only using the decimal minutes portion of the GPS output.

    Get_Lat_Current:
      SEROUT Sio, Baud, [noparse][[/noparse]"!GPS", GetLat]
      SERIN  Sio, Baud, 3000, No_Response, [noparse][[/noparse]degrees, minutes, minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
    
      ' convert to decimal format
      [s]workVal = (minutes * 1000 / 6) + (minutesD / 60)[/s]
    
    [s] Dcurrent = degrees[/s]
     [s] Mcurrent = workVal[/s]
    Mcurrent = minutesD
    
    RETURN
    
    
    Get_Long_Current:
      SEROUT Sio, Baud, [noparse][[/noparse]"!GPS", GetLong]
      SERIN  Sio, Baud, 3000, No_Response, [noparse][[/noparse]degrees, minutes, minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
    
      ' convert to decimal format
      [s]workVal = (minutes * 1000 / 6) + (minutesD / 60)[/s]
    
      [s]Dcurrent = degrees[/s]
      [s]Mcurrent = workVal[/s]
      Mcurrent = minutesD
    
    RETURN
    



    You would need to convert your waypoints into degrees, minutes, decimal minutes - but we only use the decimal minutes portion.

    LatM01 = 672
    LongM01 = 345

    This is actually easier than the way I had it and it uses less memory space but your operation area is limited. Looks like it should work well for anywhere on the school grounds though.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-16 06:24
    Attached is some code that I altered for use with just the decimal minutes portion of GPS coordinates.

    It is untested.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • blankkblankk Posts: 15
    edited 2009-09-24 15:56
    hello all


    I'm working on the same project as mitesh22, using the same parallax GPS module but another microprocessor programmed in c++ (Arduino). Im using a library written for arduino for my GPS module (http://arduiniana.org/libraries/TinyGPS/) wich provides, longtitude, latitude, date, time, course and speed in order to receive and process the data i want.
    I'm currenty writing a program in visual c++ which will be able to process an XML file from google earth, where the waypoints of my course will be saved, establish serial communication and send those coordinates (waypoints) to the microcontroller.

    My main concern is the GPS modules accuracy. The manual says that there is a +-5 meters accuracy but when I entered the longtitude and latitude i first received from the module in google earth, i found out that there must be a higher deviation than 5 meters from those coordinates and my actual position.

    Mitesh22 does the coordinates you receive from the module match your actual position? What your accuracy approximately?
    I don't know if this devation comes from the library, but i can't sit and write myself a library that process the NMEA strings due to time and programming skills limitation.

    Do you guys know in what speed should i be moving in order to avoid to use a compass and just use the GPS modules heading ?
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-25 18:57
    I know that my Garmin 12XL needs at least a good walking speed to have useful compass info, and it takes a few seconds when starting out from a stopped position.

    As for the accuracy, are you indoors? My GPS will work indoors especially if near a window but when comparing with Google Earth, it can be quite a bit off. You could test it by taking it outside where it can get as many satellites locked as possible and note the readings (and # of sats) near an identifiable landmark, make sure your GPS is using the WGS84 datum. Then go away and come back to the same place later and note the reading again - the more times the better.

    With this information you will be able to determine how well your GPS is doing. Compare the accuracy against # of satellites. If you are getting good repeatable results and it still doesn't line up with Google Earth you could just plan on offsetting all your waypoints accordingly. If your results still show a large deviation, it might be a problem with your GPS or the way it is mounted or something to do with the environment you are using it in.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • blankkblankk Posts: 15
    edited 2009-09-29 15:01
    Im always testing it outdoors. The GPS module won't lock inside my house or near the window.
    I've noticed that when i left it work for a while, the stats got more accurate.
    I'm guessing this is a result of locking more sats ? No sure though, as the library doesnt say the number of the satelites.

    Whats WGS84 datum ?


    Another thing. Do you guys think I could avoid to use a compass and use trigonometry to lead my vehicle to the correct heading?
    My vehicle is a small tank with caterpillars, which means it can rotate (change direction) without moving.

    My starting point is A and i want to reach point B. I start moving towards a random point, lets say C.
    I can find the length of the sides of triangle BCD using the Pythagorean theorem and calculate the angle 'u' using the law of cosines.
    http://en.wikipedia.org/wiki/Trigonometry

    I know that my heading is from A to C and that i need to turn my vehicle by 'u' degrees in order to have the right heading and reach my waypoint.



    scheme-1.jpg

    Post Edited (blankk) : 9/30/2009 11:01:00 AM GMT
  • blankkblankk Posts: 15
    edited 2009-10-02 14:27
    Ok, after some tests I think it is impossible to navigate correctly using this method.
    The problem is that i cant find out how much time it takes for my vehicle to rotate 360 degrees. Like i said my vehicle has caterpillars and it can rotate without moving. The time for a 360 degrees rotation depends on the surface my vehicle moves on.
    I'm gonna buy a compass after all.
Sign In or Register to comment.