# Tracking vehicle position

I am working on a car that can track its position in both the X and Y coordinate planes by using a free-spinning wheel that can rotate freely as well as turn freely I wanted to use ball bearings (orange) and rotary encoders (which would be attached to the black axles).
I cant quite figure out how to track the position though. The encoders would give me polar coordinates (angle and distance traveled), but I don’t understand how I would create an algorithm to add distance to an “X position” variable and a “Y position” variable.
The vehicle would move in an arc when turning.
I know Arduino can use sin/cos, but I don’t know how to employ them
Any help/ideas or are appreciated

Why you don´t use an IMU (Inertial Measurement Unit) instead? You could find them for about 6 €

Alvaro_Pelon:
Why you don´t use an IMU (Inertial Measurement Unit) instead? You could find them for about 6 €

I need to achieve millimeter precision

Pythagoras?

AWOL:
Pythagoras?

I don’t understand how to utilize it because of the arc that the vehicle will travel in. Sample code would be much appreciated

You are essentially using a mechanical gyroscope, which can track rotation, but, to the best of my understanding of physics, won't detect linear accelerations. So I don't see how this is going to work.

I can't make much sense of your explanation and diagram.

Wheel encoders are probably the easiest to use for robot vehicle position tracking, but you will never achieve millimeter precision and accuracy.

You have a couple of problems... pitch, slip and absolute surface positioning among others.
What's to say you don't drive over the edge of the table...

The IMU would be a good starting point, add wheel encoders, and if you need more, try a reflective (think: laser/reflective/optical mouse) technology to add very fine surface movements. Then add the boundary detection!

You'll need to figure how to prioritise these inputs based on direction, speed & acceleration, but it would yield some pretty cool results

windu34:
I don't understand how to utilize it because of the arc that the vehicle will travel in. Sample code would be much appreciated

The arc could be approximated by a series of straight lines.

Image from Original Post so I don’t have to download it. See this Image Guide

…R

windu34:
I need to achieve millimeter precision

You are not going to get millimeter precision with a mechanical device that costs less than \$100,000.

You will be lucky to get +/-100 mm precision.

...R

There are several disciplines involved, some less suited to an Arduino than others.
RAM is probably the first obstacle, then floating point performance.

Break your requirements down...

• Define Operating area.
• Generating a 'map' of the operating area (perhaps in mm resolution).
• Populate that map - before, and learn during, along with realtime position updates.
• Adjust expectations/reality with 3D IMU feedback and eheel encoder/slip calculations.
• Allow for recalibration in 3D space when near edge/corner markers.

Not simple, but maybe feasible.

Hi,
You talk about X and Y co-ordinates, you will have to know what direction you are pointed in, to add or subtract from X and Y co-ordinates.
The wheel you have will not be fixed in X or Y axis, it will be in the direction of travel, and you have no way of knowing that.

Even aircraft and marine dead reckoning use a compass to know direction.

Tom....