0
\$\begingroup\$

I am using a miniature car and I want to estimate the position. We can not use GPS modules and most of the tracking systems that I saw, are using IMU senson with the GPS module. In our car we are able to find our exact correct location with image processing but for some parts that dont have enough markings we can not do this. So we want to use the IMU as backup for our positioning. so as long as the positioning is close is good for us.

And we are only interested in our 2D position since the car is on a flat ground.

I am using a IMU 9DOF sensor and I want to calculate my movement. I have seen some amazing works with IMU for tracking body movements but no code or simple explanation is anywhere about it. So basically I have the reading from accelerometer, gyro and magnetometer. I also have orientation in quarternions. From the device I am getting also the linear acceleration but even when I am not moving it in any direction the values are not 0 which is really confusing.

Can you please help me how to approach this?

Thanks in advance

Update :

So right now we are getting the perfect heading from the quaternion values. We also have the delta_time between each heading. So what I believe we need right now is the velocity. either as a vector or as a total value.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Gravity is an acceleration force - with no movement there is still a 1g acceleration acting. \$\endgroup\$ Jan 17, 2014 at 10:22
  • \$\begingroup\$ You should be seeing an acceleration primarily along the vertical axis, with minor values for the two horizontal axes due to noise, vibration etc, when the car is not in motion. Since only 2 dimensions of movement are relevant, the vertical acceleration can be ignored. \$\endgroup\$ Jan 17, 2014 at 10:24
  • \$\begingroup\$ My sensor also can also give me linear acceleration which from what I read is the one with gravity removed! shouldn't that be zero? \$\endgroup\$
    – Khashayar
    Jan 17, 2014 at 10:25
  • \$\begingroup\$ Not zero, but minor values, i.e. significantly lower than 9.81 m/s2. \$\endgroup\$ Jan 17, 2014 at 11:24
  • \$\begingroup\$ The values are between 0 and 0.1 most of the time. but when I start_pushing it the values dont go that high that u can see the difference there are still between 0 and 1.5 or sth like that \$\endgroup\$
    – Khashayar
    Jan 17, 2014 at 12:05

1 Answer 1

1
\$\begingroup\$

Non-zero rates are normal for MEMS accelerometers and gyros. This is persistent error. It is eliminated by somehow making sure that the device is stationary for a couple of seconds (so the output can stabilize), then getting a reading. Henceforth, subtracting this steady-state error from all future measurements. Look up the datasheet of your sensor - there will be maximum values for this and other types of measurement tolerances.

Now, the much more complex subject of fusing the accelerometer, gyro and compass data. This can get hugely complicated, using Kalman filter, like Apolo once did. It can, however, be quite simple as well.

The general idea is that the magnetic sensor has slow response, low accuracy, but the error does not increase. On the other hand, a gyro's output is velocity, which is integrated to get angular position. The error grows very fast - generally you can't do dead reckoning for more than a minute with only a giro. The accelerometer is worse - it outputs acceleration, which gets integrated twice!

So, a simple fusing filter would be some linear combination of the readings of the accelerometer and compass, with the coefficient in front of the gyro descreasing over tyme.

Here is a discussion by much more knowledgeable people than me on the topic.

Note: What you are trying to do is called dead reckoning.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks for your answer, my device has kalman filter in-built so the data I thing is good enough but now how should I calculate my position? \$\endgroup\$
    – Khashayar
    Jan 17, 2014 at 10:56
  • 1
    \$\begingroup\$ @Khashayar, I have worked only with a gyro, and there the angular position was being calculated as: angular position quaternion += angular velocity quaternion * time between samples.Ask on DSP or Robotics, maybe. I am SURE there are free code samples for fusing sensor data. If I find my notes, I'll let you know :) \$\endgroup\$
    – Vorac
    Jan 17, 2014 at 12:45
  • \$\begingroup\$ I put an update about the heading \$\endgroup\$
    – Khashayar
    Jan 18, 2014 at 12:13
  • \$\begingroup\$ @Khashayar, since you are determining the heading, I guess you measured the orientation of the IMU chip in relation to the "front" of the car and recorded it as a quaternion. And next you are multiplying this constant by the gyro measurements to get world coordinates. The accelerometer should be similar. If one of it's axes is oriented "forward" - get that, subtract the steady-state error and integrate it (measurement*time interval). If the accelerometer is not oriented that well, your accelrn is sin a * axis A + cos a * axis B, where a - angle from axis A to "forward. Hoping this helps. \$\endgroup\$
    – Vorac
    Jan 19, 2014 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.