# How much accuracy could I get position tracking with a 3-axis accelerometer and gyro sensor, and compass, and how would I do it?

Given a 12' x 12' field (4m x 4m), a reasonably cheap 3-axis gyro sensor and accelerometer, and compass, I plan to design a device capable of tracking its position to sub-centimeter accuracy for a minute of motion or so.

The device has a holonomic drive system, capable of moving any direction at a maximum of about 8mph (3.6m/s), with a maximum acceleration of about 2g's. However, there are some simplifying constraints. For one, the field is nearly flat. The floor is made of a tough foam, so there is slight sinking, but the floor is flat except for a ramp of known angle (to a few degrees). The device will, excepting collisions, not be rising above the floor.

Accuracy is preferred over simplicity, so any mathematics required on the software side to improve the system would be welcomed.

Before I definitively choose accelerometers as the method of position tracking, though, I would like some idea of how much accuracy I could get, and the best ways of doing it.

• I don't think what you're asking for is possible. Can we see data sheets for your components? Generally I would be concerned about accuracy and bandwidth of your sensors. In theory if you have perfect accuracy and infinite bandwidth you can find your position through double integration. In practice these sensors (the cheap ones) have low bandwidth and not so good accuracy so the error will swamp any signal you might have in there. – Guy Sirton Jan 13 '14 at 19:53
• Well with sub-centimeter you mean what? 1mm? – Diego C Nascimento Jan 14 '14 at 1:21

First, here's what you CAN do with those sensors. Assuming you are not constantly accelerating you can use the accelerometer to know which direction is "down" (the gyro can be used as well for faster updates). If there aren't any magnetic field disturbances, you can also use the compass to know which direction is forward. Usually this is done using either an extended Kalman filter or direct nonlinear algorithms for attitude estimation (sometimes referred to as SO3).

Unfortunately, for position estimation your only option for that set of sensors is to integrate the accelerometer. In an ideal world that is enough, but in the real world all accelerometers have bias error. Over time this will just keep adding error to your position and velocity estimates. You can ballpark the error by $$e_p = \frac{1}{2} a_b t^2$$ where $e_p$ is the position error, $a_b$ is the accelerometer bias, and $t$ is time. In your case, you can reverse this to estimate that 0.010m error after 60s requires an accelerometer bias of less than 5.6e-6m/s^2, which is not going to be found in low cost accelerometers.

To achieve sub-centimeter accuracy you will need another sensor. Usually people will use cameras or laser scanners for this purpose.

The mechanics of your vehicle are not extremely relevant here; I will assume that the motion your vehicle induces on the sensors will be within their specifications.

Entire volumes have been written on "sensor fusion", which is the act of combining measurements from multiple sensors (e.g. your gyro, accelerometer, and compass). Doing this 100% accurately is impossible, so the goal is always to put some known bound on the error that can accumulate with time. You will have to research that for yourself, as the best option depends greatly on your (and your CPU's) mathematical abilities. Here is a document that discusses the development of a sensor fusion system with gyroscope, accelerometer, and compass so you get an idea of what's involved.

In the short term, one thing you can do is begin to characterize each of your sensors -- what is their precision and accuracy versus ground truth? What sort of delay do you get from their measurements? This characterization will help you more accurately combine their measurements later.

• I'm trying to get up to speed on this topic; the report you've linked to is an interesting read. +1 – uhoh Sep 21 '17 at 4:30
• Given recent innovations in the self-driving car space, are there any updates to be made? The question here is no longer very relevant given it's been nearly 4 years, but given your knowledgeability in the topic I'd love to know if there've been any interesting developments – TheEnvironmentalist Sep 21 '17 at 5:04
• The physics of those measurement instruments hasn't changed, unfortunately. However, more companies have begun offering integrated packages of these 3 sensors as computing power has increased. Last i looked (which, full disclosure, was some time ago) the cost of those sensors reflected the difficulty of the problem -- they weren't cheap. – Ian Sep 21 '17 at 10:34