Precise Robot Location in a room

What is the best way to tell a robots precise location (e.g., like with a GPS)?

I’m trying to “map” a room so my robot can drive around. I’m using three distance sensors to measure the distance left, right and front. I’m having trouble telling precisely where my robot is in the room. I’m using:

  • A gyroscope to measure the direction of the robot (north, south, east, west)
  • Optical shaft encoder to measure distance the robot has traveled

The problem is if the gyroscope reading is off by even one or two degree of rotation, the position gets off quickly as the robot travels any distance. Especially as I make several turns, a few degrees off adds up quickly.

What is the best way to keep track of the robots precise position in a room? Similar to the coordinates on a map.


If you’re talking about a “normal” sized room, such as a bedroom, etc. then GPS will probably not work. If you already know your room’s dimensions, then perhaps a combination of encoders on the wheels and touch sensors would help. The robot can touch a wall, then measure distance from there. An ultrasound combined with a servo motor + encoder could perhaps provide you with a kind of sonar scan, which might help when you’re more in the center of the room or if you don’t want to touch the walls, etc. but that could be susceptible to sound-absorbing materials or walls positioned at an angle.

Gyros tend to drift with time. I think the Vex gyros are reliable for only about 15-30 seconds (from what I’ve heard) before they need to be re-referenced to a known orientation.

If you are not limited to Vex, then you can start to get fancy and use things like lasers, etc.

You may find something useful in this thread.
Gyro drift mechanical improvements

That’s a very interesting post. :slight_smile:

I’m guessing the Vex gyro uses the vibratory structure, MEMS type of gadget, so it would make sense that high frequency vibration can mess with it.

Interesting video here:

If you’re looking at using VEX parts then I would go with encoders and a few gyroscopes. If you’re just asking about robots in general, I would do GPS way points and a laser scanner.

This is the outer limits of my abilities and would love to get some more serious discussion on this topic.

“Probabilistic determination” is what I have researched on this but applying it to Vex/RobotC environment has eluded me.

You want to say at any time, my sensors say this. Either based upon the world as I know it, where am I, or as I have built a map of the world, where am I likely right now. With the Vex game each year, there is a set world map for us, and a set starting point (up to 4).

Sensors have periods of reliability and periods of unreliability and that needs to be taken into account. Probablisitic determination means I trust soem things more than others and take them into account and say I could be in any of these places. Enough of that in a row, you should know where you are.

Pretty darn true sensors

  1. A button being pressed is pretty true
  2. Potentiometer is pretty true within 270 degrees
  3. Line followers seeing a line fully is pretty truthful

Less true sensors
4) Gyro due to drift. Getting near 180 degrees can be wacky.
5) Encoders due to wheel slippage and rotational movement (additive error over time). I intentionally moved this below gyro for IME’s and static electricity resetting your robot.
6) Ultrasonics when not within a few degrees of a wall or if there is something blocking you. Multiple sensors of this type can be problematic too.
7) Accelerometers - possible user error here but what are the right units for integrating for velocity and position. Adjust for yaw/pitch/roll and gravity.

So you have multiple sensors telling you where the robot is. If the untrasonic says you are 6 feet from the wall but there is a line under you and you think you should be 4 feet from the wall, the line seems more true. You may be able to discount the ultrasonic due to the angle to the wall being 40 degrees.

Getting that in math models is the hard part.

I am just going to throw this out here.
the way they did it is way out of the scope of what vex can do but since you mentioned things like GPS, I figured I’d throw this out here.

As far as ultrasonic sensors go, I would put it on a servo and take several readings in different directions and take the closet one as the distance from the wall. that would also give you a rough angle of where the wall is.