Jump to content

IMU Brick 2.0 get position


Recommended Posts

Hello everybody,


I'm trying to implement a code (Python) to get position x y z from IMU Brick 2.0 accelerometer, in live mode.

In the first step, I implemented the rotate accelerometer by quaternion to remove the gravity and rotation of my sensor.

After i integrate directly to have velocity and position :

example :

Vx(k) = Vx(k-1)+Ax(k)*dt

X(k) = X(k-1) + Vx(k)*dt 


Nevertheless, into my accel. data I have an offset.


Somebody would have already implemented this type of code to remove the offset (drift) ? to get the position


I don't know if i must a kalman filter or other....


Thank you

Link to comment
Share on other sites

Hello JPannetier,


I wanted to do the same a while back and did some research and I want to help not wasting time on this. To sum things up: you can't get good position information over time by only using an IMU. This topic is called Dead reckoning (https://en.wikipedia.org/wiki/Dead_reckoning) and is way harder to get running as it seems to be at first sight.


A lot of people had this idea and ended up using something different. See here for reference:



The problem is noise and precision of measurement when using acceleration or velocity data over time for estimating a position. To get a grasp of the topic I can recommend watching this video (the starting position marks the explanation of why your double integration leads to a drift):


In fact VR-headsets use sensor fusion by combining their IMU data (gyroscope and accelerometer) with their optical IR-light-based marker positions (also called pose estimation). I can recommend a very good talk by Philipp Zabel about HMD tracking systems (german language but images and animations should give you some impressions) and some related videos on youtube:



So what you could do is to:


  • Add internal sensors which track the current position with markers, by scanning a known environment with markerless tracking algorithms or by using systems like GPS
  • Add external sensors which track the position and orientation of your system and use it to recalibrate your IMU data with at least more than 30 Hz
  • Use position sensors which will inevitably affect the shape and size of your system (https://en.wikipedia.org/wiki/Position_sensor)


Hope this helps :)




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...