Go Down

### Topic: Mag + Gyro correct directions AND MagZ axis question (Read 1 time)previous topic - next topic

#### robvoi

##### Jan 18, 2013, 12:42 pmLast Edit: Jan 18, 2013, 01:26 pm by robvoi Reason: 1
Hi,

can someone confirm that I put the orientation of my IMU right.

Mag:
- If I point X to North and turn it right, MagX decreases. So MagX=MagX*-1 , correct?
- If I point Y to North and turn it right, MagY decreases. So MagY=MagX*-1 , correct?

Gyro:
- If I point X(front) upwards, AccX raises. So AccX=AccX, correct?
- If I point Y(front) upwards, AccY raises. So AccY=AccY, correct?
- If I pint Z up, the value is negative. If I point Z down it is negatve. So AccZ=AccZ*-1, correct?

Regarding MagZ: I point it North (IMU 90° tilt - so upside north) and I get positive values. I turn it right 360° but the values always stay positive.
The only way to get negative values for MagZ is if I point it 45° down and North .
What am I doing wrong here? How do I find the correct orientation for MagZ?

Thanks
Robert

#### michinyon

#1
##### Jan 18, 2013, 04:00 pm
I suggest you look at how the earth's magnetic field works.  It depends where you are.

The lines of the earth's magnetic field head generally in the direction of the north magnetic pole
and they also point down into the ground ( or out of the ground ).   The readings from the magnetic
sensor form a vector which shows the direction of this field.  When you wave the device around,  this
vector will always point in the same physical direction,  but its apparent coordinates in terms of the
nominal axes of the device will seem to change,  as you move those axes around.

If you hold the device so that one of the axes of the device is aligned with the earths magnetic field,
then the vector coordinate for that axis will be maximum  and the coordinate for the other two axes
will be close to zero.

The different sensor devices on your board are not necessarily all aligned the same way.   If they are not,
you just swap the coordinates in your code so they are.

Go Up