Shop OBEX P1 Docs P2 Docs Learn Events
Digital Compass — Parallax Forums

Digital Compass

kansasjayhawkskansasjayhawks Posts: 4
edited 2008-12-08 02:23 in BASIC Stamp
I need some advice on how I can use a digital compass on the Boe-Bot to track the x and y position of its movement throughout a room. I would like its starting position to be (0,0). I would like it to display the total distance traveled according to its coordinates rather than actual movement. The Boe-Bot is programmed to avoid walls. I would appreciate any guidance or coding!

Thanks!

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-12-07 02:03
    Well, you can't do it with just the compass. You'll need another sensor that can tell you how much you have traveled on a particular heading. The best sensor would probably be wheel encoders, which can actually do all the measurements by itself (robot rotation and translation), so you wouldn't really need a compass. If you are set on a compass, you could use an accelerometer to tell you the translation measurements. Take a look in the advanced sensors text under the accelerometer chapter.
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-12-07 17:43
    I'm always surprised when I read a recommendation to use accelerometers to measure distance traveled.· Although this is actually possible with extremely good integrators and extremely precise and high-resolution accelerometers, it is impossible in practical terms with ordinary equipment.· Accelerometers don't measure position, don't measure movement (translation or rotation), don't measure distance.· Accelerometers measure acceleration. the second derivative of position.· To calculate position from accelerometer data requires a double integration, and unless you start out with exceedingly high-precision data and do your calculations with many digits of precision (not a job for an 8-bit or 16-bit computer), the errors quickly swamp the measurements.· Very quickly.· Very.

    However, the suggestion of counting turns of the wheels is an excellent one, especially in combination with a compass.· Perhaps you might choose a single wheel whose direction you always know from a compass, and count its turns.· Then you'll know how far it moved, and in which direction.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • awesomeduckawesomeduck Posts: 87
    edited 2008-12-08 02:23
    For the most part I agree with Carl, its going to be pretty inaccurate with the BS2 and an accelerometer for distance. However, the Smart Sensors and Applications book, page 237 shows how you can calculate distance with an accelerometer but without using calculus. For the speeds your robot is running at this approximation would be ok, but you will be limited to best case 100 accelerometer samples per second.

    If you could use electrical tape to make a grid on the floor then you could use the QTI line sensor and the compass together to build a coordinate based project. But as has been send above the compass only only give you direction, not distance.
Sign In or Register to comment.