Shop OBEX P1 Docs P2 Docs Learn Events
Compass vs GPS for actual heading? — Parallax Forums

Compass vs GPS for actual heading?

Tom CTom C Posts: 461
edited 2008-10-02 19:39 in Robotics
Hi all,

I have been collecting and analyzing BS2 programs for an autonomous rover.

I have looked at Chris Anderson's BS2p UAV program and found that he used the GPS for actual heading and desired heading.

Another person on the Parallax Robotic Forum used the Hitachi HM55B compass to determine the actual heading and the GPS for the desired heading.

Does anyone know the pros and cons of using either the compass or the GPs for the actual heading?

Regards,
TCIII

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-10-02 14:15
    Tom,

    The difference is that the GPS calculates heading based on current coordinates vs previous coordinates. From that information it determines which way it is moving and thus it must be in motion to get an accurate heading. A compass module can give you a static heading and is therefore used on most higher-end GPS systems for accuracy. Bear in mind that due to slight errors in the GPS signal, while static a GPS module can sometimes think it is moving a bit and therefore give you an inaccurate static heading. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • SRLMSRLM Posts: 5,045
    edited 2008-10-02 16:48
    "Actual Heading" and "Desired Heading"... Hmm... Seems like some terms that are familiar. Perhaps it was me? Please say it was. Please, please (fingers crossed). Well, either way I'll tell you the way that I'm doing it.

    At first (when I was naive) I thought that the GPS would be good for everything. Boy was I wrong. It's good for telling you where you are on a grid about a four-sqaure court size. For my first project, the movement speed was about an inch a second (BOE-BOT). So now I'm on to version two.

    I use the compass to tell me which dirrection the robot (a new, more capable one) is pointed. N, S, NE, etc. Then the BS2 reads from a datalogger what the destination coordinate is. It gets the current coordinate via the GPS, and fromt the two uses the Pythagorean theorem to construct a mathematical tiangle, and figure out in which dirrection the robot should go. Note that, with the BS2, some contortions are needed, since numbers cannot be larger than 65535. When you start to square things, numbers get big really fast. Also note that the global coordinate system is not set up the same way as the traditional mathematical models go. (For the western hemisphere) the x axis (longitude) increases from the right to the left (when looking at a map), so you'll have to compensate for that. Also, 0 degrees north is at the top of the axis, parallel to the y. For most mathematical operations (including those of the BS2) 0 degrees starts on the x axis on the right. You'll need to offset for that too.

    Okay, so once the GPS desired heading is calculated (note that it's calculated, not measured with the heading command), it's compared to the actual heading and a desired heading. This desired heading is passed to the sensors (ping and bumper), where if figures out which way it can go, with a bias towards the desired heading.

    Well, that's pretty much it. It took me about 10 or 12 hours to think about, design, write, and debug the heading calculation code, so it's not a light step.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-10-02 18:48
    SRLM,

    GPS is not intended for such a small area as even in lieu of resolution there is an inherent error that can throw these readings off by several yards. GPS is more useful on a larger scale.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • SRLMSRLM Posts: 5,045
    edited 2008-10-02 19:39
    That's what I discovered, and why I'm using it to simply say where the robot is, not which dirrection it's heading. I found that for where I am, it gets resolution plus error of about 2-3 yards. Since my project is for a scale where the bot is expected to travel 100 yards or more, this is more than good enough for what I need. Since I don't have anything better, I use GPS. I took a look at using some sort of beacon system, but they're expensive and require setup. Mostly, it's a case of "What can I do with what's available?"
Sign In or Register to comment.