Gyro Mag and Acc axis

Post Reply
bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Gyro Mag and Acc axis

Post by bill516 »

I see quite a few questions lately about the orientation of the XYZ for these components. I too am confused by the settings of these as they dont seem to bear any resemblence to any logical order for instance my acc is mounted to the board the same way as the marking for XY are printed on it yet the mag in rotated 90deg CW to that and the gyro is mounted 90deg CCw to the acc. Thanks to work done by Katch when I first got this IMU he uploaded a load of defines one of which was the IMU I have so I was able to get it to work as it should but I still dont understand how it does it. So if someone could explain the relationship of the 3 axis and how one affects the other it might cure my confusion and help a few other people at the same.

Give a man a fish and he can feed his family for a day, teach him to fish and he can feed them forever, or until over fishing depletes the stocks.

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Gyro Mag and Acc axis

Post by justk1w1 »

Bill516,

Now that I have been through a lot of the issues with the sensor orientation I have found a excellent write up here:
http://www.multiwii.com/wiki/index.php? ... rientation
This gives the reactions that you should see when the craft is moved through the various axis.

Cheers
JustK1w1

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: Gyro Mag and Acc axis

Post by bill516 »

Thanks for that but it doesnt explain the realationship of the various axis. In that link you gave it shows the axis for roll pitch and yaw as XYZ for acc, gyro and mag, no problem with that and I understand it, the problem comes for me when I look at the settings for my IMU roll pitch and yaw are -X -Y Z for ACC, Y -X -Z for GYRO and X Y -Z for MAG. As you can see the ACC has the XYZ in a different order to the others. If the orientation of the sensors axis is changed by moving the XYZ axis by the YX-Z command then it starts to make some sense but all my trials have not produced any evidence that that is so, unless I have been moving the wrong axis and looking at the wrong values. For my ACC does the reversal of X Y change the axis to Y X so that roll is now Y and pitch is X, I think if I get the answer to that I will then understand the relationship between the axis.

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Gyro Mag and Acc axis

Post by justk1w1 »

My understanding of the axis for both the Gyro and the ACC (correct me if this is wrong) but both measure the relative force (amount or rate) exerted on all three axis the gyro measures the rate and the acc the acceleration. There is not specific XYZ, however when the two are combined on the same plane (board) then you have to make sure that the axis that is measuring acceleration(acc) is the same axis for the rate of change(gyro). As each manufacture has a different approach to how they layout the components then it is sometimes necessary to swap the readings taking from the sensors to ensure that all sensor readings are actually assigned to the correct axis. It would probably be less confusing if the outputs from the sensors were just listed as axis1, axis2, axis3. Then you could say that the x axis (roll) of the board is made up of Acc axis1, Gyro axis2 and Mag axis1. The y axis (pitch) of the board is made up of Acc axis2, Gyro axis1 and Mag axis2 , etc , etc. The minus sign ensures that the value output for the axis are aligned for all axis ( roll goes up for all sensors when the craft is tilted to the right)
The orientation of the board is defined by the Acc axis that shows the 1G force relative to gravity

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: Gyro Mag and Acc axis

Post by doughboy »

to make things more confusing, the 6050 chip contains both gyro and acc, yet their orientation is opposite!

#if defined(GY_521)
#define MPU6050
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = -X; accADC[PITCH] = -Y; accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
#undef INTERNAL_I2C_PULLUPS
#endif

I am interested in how exactly XYZ axis is determined as well, and not just by trial and error as that link suggests.

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: Gyro Mag and Acc axis

Post by doughboy »

it must be a multiwii software thing that causes all this orientation mismatch

according to 6050 data sheet, the gyro and acc axis is the same

Image

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: Gyro Mag and Acc axis

Post by doughboy »

I'm going to venture a guess that the base or reference gyro and acc orientation has something to do with how it is oriented in Wii motion plus and nunchuck. I agree that at first glance it makes no sense, I think someone should document this reference axis oreintation in the wiki. This will clearly explain why you have to put your X this way and why you need to put a - sign, etc. rather than that trial and error procedure given in the wiki.

i3dm
Posts: 57
Joined: Tue Oct 01, 2013 4:48 pm

Re: Gyro Mag and Acc axis

Post by i3dm »

im facing the same situation with an inverted mounted MPU6050, and while i haven't tested this yest, the explaination in the Wiki seems rather simple, isnt it?

handsomejackuk
Posts: 97
Joined: Mon Sep 08, 2014 12:25 am

Re: Gyro Mag and Acc axis

Post by handsomejackuk »

bump this for reference....

Post Reply