Accessing the accelaration data in BNO055 IMU sensor and calculate distance traveled

Thread Starter

akshay_acharya

Joined Sep 1, 2020
3
hello @Mark Hughes ,
I read your BNo055 article. I am currently working with it. It is a part of a MOAB board and Im supposed to use it to calculate the distance moved by the bot on which the board is mounted in real time. I have the imupacket.py file whihc tells me that there are linear accel, normal acccel, mag and gyro sensordata available which I can directly access. Im not sure how to calculate the distance moved using the linear accelaration. I only need the accelaration in y and x direction as the bot will move in that plane. Why is the accelaration value not 0 when the bot is stationary? And how to perform integration on the incoming accelaration values to get distance? Im unsure how to calibrate and if calibration is needed at all in the first place for accelerometer. And the differernt fusion and non fusion modes and how to access. Im fairly new at this.
 

KeithWalker

Joined Jul 10, 2017
3,063
To calculate distance, first you need to sample the normal acceleration output from the accelerometer at pre-determined intervals. Then differentiate (not integrate) the acceleration data by dividing the difference between adjacent samples by the time interval between them. This will give you the velocity. Then do the same again to the velocity values to get displacement. The sum of the displacement values is the distance traveled.
Regards,
Keith
 

John P

Joined Oct 14, 2008
2,025
No, you do integrate acceleration to get velocity, and velocity to get position. But with inexpensive sensors, this method of calculating position never works well. A small error in input rapidly becomes a large error in output!
 

Thread Starter

akshay_acharya

Joined Sep 1, 2020
3
To calculate distance, first you need to sample the normal acceleration output from the accelerometer at pre-determined intervals. Then differentiate (not integrate) the acceleration data by dividing the difference between adjacent samples by the time interval between them. This will give you the velocity. Then do the same again to the velocity values to get displacement. The sum of the displacement values is the distance traveled.
Regards,
Keith
Thanks for replying @KeithWalker but isnt accelaration the rate of change of velocity? So shouldnt it be the integral?
 

Thread Starter

akshay_acharya

Joined Sep 1, 2020
3
No, you do integrate acceleration to get velocity, and velocity to get position. But with inexpensive sensors, this method of calculating position never works well. A small error in input rapidly becomes a large error in output!
Is the BNO055 sensor not of good quality? What is the error margin with a sensor of this grade?
 

KeithWalker

Joined Jul 10, 2017
3,063
I apologize for the wrong label. It is easy to do at my age! The steps I described are integration, not differentiation. You do integrate acceleration it get velocity and velocity to get displacement. As you can see, each calculation is the sum of many measurements so measurement errors and computer rounding errors are accumulative and can be significant.
For a wheeled vehicle, measuring the angle of rotation of a wheel will give much more accurate results. Using that along with the x/y directional output from the accelerometers you can calculate relative position.
Regards,
Keith
 
Top