J.Bryan
Posts: 42
Joined: Tue Aug 01, 2017 2:44 pm

Orientation of the mounted gyroscope and accelerometer's axis

Tue Feb 13, 2018 1:52 pm

Dear All,

I would like to get some advice and help on my sensor's placement.

I have two sensors on my robot, one of it is the Accelerometer:

Image

Another sensor is the gyroscope:

Image

I know how to read the raw data of the accelerometer and convert it to it's pitch and roll. Similarly, I also know how to read the raw data of the accelerometer and convert them to dps for each axis.

From my research I understood that the xyz axis can be represented by:

Roll - Rotation about the x axis.
Pitch - Rotation about the y axis.
Yaw -Rotation about the x axis

On my robot I mounted the sensor in this manner:
https://drive.google.com/file/d/1GeUxvu ... 7-5gg/view
(I realise that the image is not displayed in the thread so I attached a link, I am sorry.)

In my actual application, I am only concern about rotating around the y axis of the accelerometer (The sensor on top).

I would like to do a sensor fusion on the data e.g kalman. When I pass in the y axis's calculated pitch data from trigonometry into the kalman filter, do I pass in the x-axis data or y-axis data of the gyroscope (sensor on the bottom) into the kalman filter.

I have some confusion as the xy axis's orientation of both the sensor is different. Is it more correct to use the x-axis's data of the gyroscope (as it is in the same direction as the y-axis of the accelerometer) or is there more to it?

Thank You!

User avatar
OutoftheBOTS
Posts: 602
Joined: Tue Aug 01, 2017 10:06 am

Re: Orientation of the mounted gyroscope and accelerometer's axis

Tue Feb 13, 2018 8:00 pm

Ok to understand what the data that comes out of these sensors.

The gyro isn't a gyro but in fact reads centrifugal force i.e the rotation speed around an axis

The Accelerator doesn't just read acceleration but in fact reads the linear force. It will read the pull of gravity when no acceleration is happening then if acceleration is happening then it will read the pull of gravity plus the forces applied by the acceleration.

Hopes this helps you :)

J.Bryan
Posts: 42
Joined: Tue Aug 01, 2017 2:44 pm

Re: Orientation of the mounted gyroscope and accelerometer's axis

Mon Feb 19, 2018 3:36 am

OutoftheBOTS wrote:
Tue Feb 13, 2018 8:00 pm
Ok to understand what the data that comes out of these sensors.

The gyro isn't a gyro but in fact reads centrifugal force i.e the rotation speed around an axis

The Accelerator doesn't just read acceleration but in fact reads the linear force. It will read the pull of gravity when no acceleration is happening then if acceleration is happening then it will read the pull of gravity plus the forces applied by the acceleration.

Hopes this helps you :)
Hi OutoftheBOTS,

Is it normal to still have bias in the data even after sensor fusion of accelerometer and gyroscope data? I want to know if it is possible to "zero" the readings.

Attached is a video of my attempt to zero the data:
Accelerometer and gyroscope mounted on a breadboard and place flat on the floor


Thank You.

User avatar
OutoftheBOTS
Posts: 602
Joined: Tue Aug 01, 2017 10:06 am

Re: Orientation of the mounted gyroscope and accelerometer's axis

Tue Feb 20, 2018 10:59 am

The gyro mush have an offset so that it will read zero when totally still. To get this offset place the IMU perfectly still and read the gyro data then this will be your offset. The compass also needs to be calibrated for the exact local magnet field (the place on the earth it is being used at) this is normally done by taking reading for a full 360 degree turn then averaging it. The accelorometer shouldn't need any calibration.

I suggest you maybe look at this hardware as it is the best IMU + hardware fusion that I have seen https://www.tindie.com/products/onehors ... -solution/

Also this guy has a PHD robotics and has spent a lot of time testing IMUs and is probably the most knowledgeable guy on IMUs https://github.com/kriswiner

Idahowalker
Posts: 231
Joined: Wed Jan 03, 2018 5:43 pm

Re: Orientation of the mounted gyroscope and accelerometer's axis

Tue Feb 20, 2018 6:28 pm

The offset of the Gyro can be read by placing the gyro on a flat surface and taking a measurement of the procession. Turn the gyro 180 degrees out of phase with the original position and measure the procession. Best to allow the gyro to settle for, say, 3 minutes, before taking measurements.

Even better would be to mark off several positions and positions of opposition to take measurements from.

The same can be done with the accelerometers.

The readings obtained can be used as offsets for 'gyro and accelerometer' drift.

Take the reading for a minute or two, per second, and then develop a median from each position. Use the median of positions in summation to develop and offset.

A reading from 0 degrees to 90 degrees is a positive reading, a reading from 90 to 270 degrees is a negative reading, and a reading from 270 to 360 is a positive reading.

If the gyro is showing a median offset of +.005 degrees (say 50 readings) at the position of 0 degrees and the gyro is showing a median offset of -.004, the summed offset is +.001. If there were 10 readings taken of the X gyro taken at differing ordinal references those readings could be summed together for a better offset number. It is best to take the readings in a temperature stable environment and to take the readings during a high tide and a low tide, to remove/reduce gravity fluctuations caused by the moon.

One may also use an offset to get rid of the Coriolis force, a constant.

It is best to use the arrows marked on the module to determine which accelerometer to use for the X axis. The confusion will be that the physical position of the X accelerometer will measure accelerations around the Y axis and the physical location of the Y accelerometer will feel accelerations around the X axis.

Good luck.
Being a programmer: She says go to the store get 1 bottle of milk, if they have eggs bring back 6. She gets mad cause I brought back 6 bottles of milk.

J.Bryan
Posts: 42
Joined: Tue Aug 01, 2017 2:44 pm

Re: Orientation of the mounted gyroscope and accelerometer's axis

Fri Mar 16, 2018 12:03 am

Hi OutoftheBOTS and Idahowalker,

Thanks for your help.

I have one more question and was just wondering if you know how to fix it.

I will try to illustrate what I want to ask clearly.

I am able to read my accelerometer raw value and convert it to pitch and roll.
I am also able to read my gyroscope value and convert it to degree per second.

I did a kalman filter and fused the data from both the sensor. And despite using a kalman filter, I am still getting some sort of minor error and flactuation.

e.g when the sensor is stationary the value read something like (in degree):

kalman_Output = {0.125, 0.100, 0.175, 0.200, 0.125, 0.175, ........}

So as you see there is still some sorts of "fluctuation" despite a kalman filter. I deem that as a normal behavior(correct me if I am wrong) since sensors are not created perfectly.

I know I can get the angular rotational velocity directly from the gyroscope, but as I mentioned sensor is not perfect so I am not able to "zero" the gyroscope reading properly as such error in measurement is introduced to the system.

To "reduce" the error I decided to go with an alternative method to calculate the velocity using the output from my kalman filter's output.  

Code: Select all

The idea is : velocity = (y[n] - y[n-1])/t
where:

Code: Select all

       y[n]   refers to current angle reading from kalman filter
       y[n-1]  refers to previous angle reading from kalman filter
         t     refers to sampling loop time`
Now using this method I am also having fluctuation in velocity calculation. I want to reduce the fluctuation in the velocity because I need the velocity to be as accurate as possible.

Should I take the output of the kalman filter and pass it through a software low pass filter example:

 

Code: Select all

#define alpha 0.1 
  kalman_LPF = (current_kalman_Angle * alpha) + (previous_kalman_Angle * (1.0 - alpha));
Here is a video to what I am describing:[Kalman Output and Velocity Graph]Kalman Output and Velocity Graph

The red color graph is the output from kalman filter.

The blue color graph is the velocity calculated using

Code: Select all

velocity = (y[n] - y[n-1])/t
Does you have any suggestion on how to reduce the "fluctuation"? Please let me know if you need more information. Thank You.

User avatar
OutoftheBOTS
Posts: 602
Joined: Tue Aug 01, 2017 10:06 am

Re: Orientation of the mounted gyroscope and accelerometer's axis

Fri Mar 16, 2018 7:59 am

inertia sensors like gyro/accelerometer have very good accuracy in the very short time frame but over time the error accumulates.

Compass sensor has very poor accuracy in short term as compass swings around a little but the compass sensor will average very high accuracy over long term.

So if you fuse the inertia data with the compass data you will get much lower error. Basically the the short term orientation from the inertia sensors will be good but the orientation needs to be re-calibrated over the longer term to the average of the compass data

pootle
Posts: 234
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Orientation of the mounted gyroscope and accelerometer's axis

Fri Mar 16, 2018 10:19 am

sensor fusion is still as much an arcane art as a science. Save yourself hours (days? weeks?) of endless fun by using a device with all the sensors already integrated like the Bosch BNO055.

You can even get it in a handy package from adafruit....

Cheaper devices that run the fusion code in your CPU are also available - but most of the libraries are for arduino...

User avatar
OutoftheBOTS
Posts: 602
Joined: Tue Aug 01, 2017 10:06 am

Re: Orientation of the mounted gyroscope and accelerometer's axis

Fri Mar 16, 2018 8:50 pm

sensor fusion is still as much an arcane art as a science. Save yourself hours (days? weeks?) of endless fun by using a device with all the sensors already integrated like the Bosch BNO055.
I read the data sheet and the claims of the BNO055 and thought wow this is great just play and play IMU sensor fusion and brought 1. After testing I found the same result as everyone else that the drift is about as bad as it gets for any IMU sensor.

1 of the best places to see the most tested IMU data and code for running them is this guy that has a PHD in IMU, here is his github https://github.com/kriswiner?tab=repositories

The guy also makes and sells IMU sensor boards and finds he sells a lot of BNO055 due to it datasheet claims made famous by Adafruit demo but many customers come back and buy this 1 as it works much more accurately https://www.tindie.com/products/onehors ... -solution/ it is a MPU9250 with a hardware fusion filter on board.

Idahowalker
Posts: 231
Joined: Wed Jan 03, 2018 5:43 pm

Re: Orientation of the mounted gyroscope and accelerometer's axis

Fri Mar 16, 2018 9:43 pm

Mount the accelremoters onto a gyro stabilized platform.

Here is an image of the components working together:

Image


Brushless gimbal: http://www.instructables.com/id/Brushle ... h-Arduino/
Being a programmer: She says go to the store get 1 bottle of milk, if they have eggs bring back 6. She gets mad cause I brought back 6 bottles of milk.

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 13 guests