Heading 180 degree out

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

Heading 180 degree out

Post by justk1w1 »

Hi All,

Just spent the last couple of days trying to sort out an issue with the heading being 180 degrees out. I'm using a 10DOF Chinese board with ITG3200, BMA020, BMP085 and a HMC5883L connected to a MEGA2560 and running Multiwii 2.1. The sensors are defined in the independent sensor section of config.h
I have followed the connecting elements guide and have ensured all the elements are acting in the correct fashion, however the heading readout in both Mulitwii_conf and Multiwii_GUi are showing the copter as being 180 degrees out. When I have the copter sitting pointing west both GUI's display the copter as pointing east.

Have I missed a configuration parameter somewhere??

Regards
JK

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

Re: Heading 180 degree out

Post by bill516 »

You need to change the orientation of the mag in the orientation at the end of the individual sensor section. I would tell you which one it is but I asked a question some time ago about orientation but never got a reply so I dont know. I do know that - in front of the axis inverts that value so only thing I can tell you is put a - before the axis letter or remove it if it is there, do it one at a time and I'm sure you'll get it. Or somebody will be along and say ABC or XYZ and that will it your problem will be sorted, or you could try and pm Katch he did a load of defines when these china IMUs hit the market he understands XYZ orientation.

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

Re: Heading 180 degree out

Post by justk1w1 »

Bill516,

Thanks for that - I have been through all the setup and set the orientation so that it is as stated in the "Connecting elements section of the doco". With the orientation so that all the sensors act as required then I end up with a heading that is 180 degree out. If I reverse any of the axis then this throws out the sensor axis directions (as you would expect). My orientation settings are:
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = Y; accADC[PITCH] = X; accADC[YAW] = -Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = -X; gyroADC[PITCH] = Y; gyroADC[YAW] = Z;}
#define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL] = Y; magADC[PITCH] = X; magADC[YAW] = -Z;}
and all appears to work correctly in roll.pitch and yaw (heading moves as expected with the movement of the quad) it's just 180 degrees out??

capt
Posts: 54
Joined: Wed Jan 19, 2011 10:54 pm

Re: Heading 180 degree out

Post by capt »

You may have to physically remount the 10DOF board and go through the process all over again.

It has to do this>

How should be the sensor axis directions

TILT the MULTI to the RIGHT (left side up):
•MAG_ROLL, ACC_ROLL and GYRO_ROLL goes up
•MAG_Z and ACC_Z goes down

TILT the MULTI forward (tail up):
•MAG_PITCH, ACC_PITCH and GYRO_PITCH goes up
•MAG_Z and ACC_Z goes down

Rotating the copter clockwise (YAW):
•GYRO_YAW goes up

The copter stays level:
•MAG_Z is positive ; ACC_Z is positive

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

Re: Heading 180 degree out

Post by justk1w1 »

Done all of this - however each time I seem to get at least 1 of the mag directions opposite. Now setup another small quad and a bicopter with same results - silly question but does being in southern hemisphere make and diff to the expected results and therefore make the heading wrong. I can make the heading correct by reversing the expected result for may roll. What effect does the may roll have in the imu/mixing calcs or is it just used for heading stabilization.

Thanks

xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

Re: Heading 180 degree out

Post by xoxota »

Did you set your magnetic declination in config.h?

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

Re: Heading 180 degree out

Post by justk1w1 »

Mag declination for Melbourne Australia is 11.3 - all set .. this should only effect a small heading variance to magnetic north .. not a full blown 180 degree?

el_nono
Posts: 2
Joined: Wed Sep 28, 2011 2:39 pm

Re: Heading 180 degree out

Post by el_nono »

I have same problem and live in Argentina.
South latitude problem?

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: Heading 180 degree out

Post by scrat »

el_nono wrote:I have same problem and live in Argentina.
South latitude problem?


http://magnetic-declination.com/

http://www.satsig.net/degrees-minutes-s ... ulator.htm

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

Re: Heading 180 degree out

Post by justk1w1 »

Just found this that my answer some of the issues - can this be added to the connecting elements section - good explanation on the differences between the northern and southern hemispheres for calibrating the magnetron
http://paparazzi.enac.fr/wiki/ImuCalibr ... gnetometer.

tovrin
Posts: 705
Joined: Tue Sep 20, 2011 4:08 pm

Re: Heading 180 degree out

Post by tovrin »

I'm curious, how have you been calibrating your magnetometer?

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

Re: Heading 180 degree out

Post by justk1w1 »

As per the standard, but if you set the axis as described in the connecting elements the it ends up 180 degree out. I ended up changing the axis to get the heading correct and correct rotation. I was more pointing out the description about the difference in the expected axis direction between the northern and southern
Cheers

AussieChris
Posts: 1
Joined: Wed Jan 02, 2013 11:45 pm

Re: Heading 180 degree out

Post by AussieChris »

Hi all, just registered, so firstly a big thank you to the Multiwii authors and contributors.

JK (justk1w1), did you manage to sort out this problem with the mag heading? I have exactly the same problem with a Crius SE and I also live in the southern hemisphere. And yes, I have calibrated the magnetometer.

With the original defines for the Crius SE of {magADC[ROLL] = X; magADC[PITCH] = Y; magADC[YAW] = -Z;} the compass heading is correct. However, the Roll and Pitch work opposite to what is specified...

TILT the MULTI to the RIGHT (left side up):
ACC_ROLL and GYRO_ROLL go up but MAG_ROLL goes down.

TILT the MULTI forward (tail up):
ACC_PITCH and GYRO_PITCH goes up but MAG_PITCH goes down.

MAG_YAW is negative.

I changed the define to {magADC[ROLL] = -X; magADC[PITCH] = -Y; magADC[YAW] = Z;} and that fixed the Roll and Pitch issue and also made MAGYAW positive. However, the compass heading is now 180° out.

So the question is: What is more important - getting the mag Roll and Pitch data correct (it might not get used anywhere) or having the compass heading correct? I'm guessing the absolute heading is probably not important until you add GPS and try to use the return to home function.

Chris
Brisbane, Australia.

SergioC
Posts: 19
Joined: Sat Dec 22, 2012 11:33 pm

Re: Heading 180 degree out

Post by SergioC »

try to negate only the Z term
{magADC[ROLL] = -X; magADC[PITCH] = -Y; magADC[YAW] = -Z;}


Sergioc.

Post Reply