Shop OBEX P1 Docs P2 Docs Learn Events
GPS and steering — Parallax Forums

GPS and steering

halfblinddadohalfblinddado Posts: 59
edited 2013-01-03 05:09 in Robotics
Does anyone have experience with driving a robot by a GPS and compass?

I have cobbled together a program that gets a heading from 2 GPS coordinates, compares it against the current compass heading and then steers the robot. Everything is working as I expected except the GPS takes longer than a second to refresh. This is a problem because by the time I get the new heading the robot has moved (for at least one second) to a new heading. This causes the robot to constantly correct (spinning in a circle, swinging left and right). Every once in awhile the compass and the GPS align at the right time and the robot moves forward.

I'm sure this question has been asked before but I searched the forum and found nothing.

Any help would be greatly appreciated.

Comments

  • halfblinddadohalfblinddado Posts: 59
    edited 2013-01-01 19:15
    Thanks Erco,

    I have already gotten past the navigation part. What I need to know is how to steer the robot with the information.

    Thanks,

    Mike
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-01 21:06
    I'm pretty sure you're going to need encoders in order to keep your robot travelling straight. Steve's compass example is a good illustration of how to do this. Besides the encoders, you'll probably also need a compass (which is sounds like you already have).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-02 10:48
    I am working on a "proof" of concept" and have cobbled together a program that gets a heading from GPS coordinates, compares it against the current compass heading and then steers the robot toward the second set of coordinates. Everything is working as I expected except the GPS takes longer than a second to refresh. This is a problem because by the time I get the new heading the robot has turned (for at least one second) to a new heading. This causes the robot to constantly correct (spinning in a circle, swinging left and right). Every once in awhile the compass and the GPS align at the right time and the robot moves forward.

    I believe this is referred to as " hunting". I can't get the GPS to refresh any faster so the only solution I can think of is to stop the robot, take a reading, turn the robot then move forward again. I'm interested to know how others handle this.

    I thought I'd not fill up Steve's thread with my reply so I'm posting in this thread.

    From what I've read, the GPS heading feature doesn't work well at slow speeds and not at all while sitting still.

    You need some way to determine heading without having to constantly rely on the GPS. I'm pretty sure the sandard way to solving this problem is to use encoders and to be able to determing how the robot's heading has changed by using the encoders.

    I think you'd be well off to be able to have control of your robot's heading using encoders only and then add a compass and only use the GPS to detemine where you are.

    If you haven't read Phil's encoder paper, you should.

    A lot of us have used erco's figure 8 challenge as way of learning how to use encoders on our robots. It's be great to see an entry from you.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-01-02 11:12
    Does anyone have experience with driving a robot by a GPS and compass? I have cobbled together a program that gets a heading from 2 GPS coordinates, compares it against the current compass heading and then steers the robot. Everything is working as I expected except the GPS takes longer than a second to refresh. This is a problem because by the time I get the new heading the robot has moved (for at least one second) to a new heading. This causes the robot to constantly correct (spinning in a circle, swinging left and right). Every once in awhile the compass and the GPS align at the right time and the robot moves forward.

    I'm not sure how your code is setup but it sounds as if you're basing your new heading on the GPS heading. In code I have been working on I get the current cordinates from the GPS every second and calculate the heading, but then that is always based on my current heading from the compass module, so if you know the heading you want and you compare it to the compass heading you shouldn't be over/under-correcting as much. I guess it also depends on how your robot steers as to how much of that you will see.
  • Martin_HMartin_H Posts: 4,051
    edited 2013-01-02 11:24
    Duane Degn wrote: »
    A lot of us have used erco's figure 8 challenge as way of learning how to use encoders on our robots. It's be great to see an entry from you.

    Don't forget the Ultrasonic orbit challenge. Knowing how to do that could be handy to navigate around an obstacle to get back on a compass heading. Here's the thread:

    http://forums.parallax.com/showthread.php?144539-Erco-s-Ultrasonic-Orbit-Challenge

    Speaking of the Ultrasonic orbit challenge. So far the BS2 contingent are the only sub-forum members to complete the challenge. The Propeller proponents have been notably absent.
  • ercoerco Posts: 20,256
    edited 2013-01-02 13:22
    Martin_H wrote: »
    Speaking of the Ultrasonic orbit challenge. So far the BS2 contingent are the only sub-forum members to complete the challenge. The Propeller proponents have been notably absent.

    I think Duane and Ttailspin are afraid. Really fearful.
  • Tom CTom C Posts: 461
    edited 2013-01-02 16:11
    Hi All,
    My 6WD rover using ArduRover code on a APM1.4/Oilpan complete with LEA-6 GPS and a HMC5883L compass goes pretty straight from waypoint to waypoint without any wander. But then again, it is not a BS2 nor a Propeller. Just an Atmel 2560 processor. No wheel encoders involved.
    Just a thought.
    Regards,
    TCIII
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-02 18:40
    Tom C wrote: »
    Hi All,
    My 6WD rover using ArduRover code on a APM1.4/Oilpan complete with LEA-6 GPS and a HMC5883L compass goes pretty straight from waypoint to waypoint without any wander. But then again, it is not a BS2 nor a Propeller. Just an Atmel 2560 processor. No wheel encoders involved.
    Just a thought.
    Regards,
    TCIII

    Tom, do you have this robot documented anywhere? I'd like to see it.

    Do you use the compass for direction? Is the GPS heading feature useful or do you just rely on the compass.

    If you tell your robot to drive straight, how straight does it go? I wonder if 6WD offers an advantage to driving straight without encoders.
  • Tom CTom C Posts: 461
    edited 2013-01-03 05:09
    @Duane,

    Here you go:

    Original JLN concept on DIY Drones: http://www.diydrones.com/profiles/blogs/apmrover-1280-a-fun-ugv-project-for-in-full-autonomous-reco

    My build log on DIY Drones:http://www.diydrones.com/forum/topics/tciii-ardurover-traxxas-e-maxxs-build-log?groupUrl=ardurover-user-group&groupId=705844%3AGroup%3A903163&id=705844%3ATopic%3A981571&page=4#comments

    The GPS is used to move from waypoint to waypoint and to detect when the rover has arrived at a given waypoint.

    The compass is used to help keep the rover from drifting durning the movement from waypoint to waypoint.

    We are using a GPS that has very good accuracy and repeatability. There is talk on the forum of being able to get the LEA-6 accuracy down to under a foot with just software.

    Regards,
    TCIII
Sign In or Register to comment.