MAG sensor orientation - how?

Post Reply
User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

MAG sensor orientation - how?

Post by Hamburger »

Hi,

I found info on how to setup the gyro and acc orientation with the feedback from GUI.
But how do I find out the MAG orientation? I can see the values in the GUI change when I rotate the copter, but how do I translate that into the X,Y,Z orientation?
I have a freeimu v.01 with hmc5843. The gyro and acc are setup already.

Thanks, Hamburger

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MAG sensor orientation - how?

Post by Alexinparis »

Hi,

Z MAG should be positive and not move a lot if the multi remains flat.
X MAG: ROLL RIGHT = positive; ROLL LEFT = negative
Y MAG: PITCH FORWARD = positive; PITCH backward = negative

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: MAG sensor orientation - how?

Post by Hamburger »

thanks.
Then the submitted code fragment for FREEimu v01 is correct.

skygizmo
Posts: 6
Joined: Sat Jul 16, 2011 12:20 am

Re: MAG sensor orientation - how?

Post by skygizmo »

Hi
have a question about the MAG sensor.
if I activate the MAG sensor on the front boom pointing north. if the wind turns towards north-west quad, then of course the quad to turn towards the north again.
What would happen if I activate the MAG sensor on the front boom pointing towards the north-west? and the wind driving it toward the south, it will then turn towards the north-west again?
it means that the front beam is locked to the compass directions in which MAG sensor is activated?

thanks in advanc

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MAG sensor orientation - how?

Post by Alexinparis »

The important thing is not the absolute direction of the arrow, but the difference to the direction at the time the MAG was activated.
This difference is computed to be a -180;+180 angle difference and this is the input for the mag correction.

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: MAG sensor orientation - how?

Post by Sven »

Alexinparis wrote:Hi,

Z MAG should be positive and not move a lot if the multi remains flat.
X MAG: ROLL RIGHT = positive; ROLL LEFT = negative
Y MAG: PITCH FORWARD = positive; PITCH backward = negative


Sorry for dragging this old cow ashore again, but it seems ive run into a bit of trouble.
I suspect despite running the numbers like mentioned above, something is amiss orientation wise.
Unless its normal for a magnetometer to completely lose its marbles after being tilted >10' ?
Im running a HMC5883L mag, on dev_20120225 firmware.
The mag behaving so dodgy in the winGui makes me hesitant about flipping it into headfree mode. :|

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MAG sensor orientation - how?

Post by Tommie »

I am having the same issues. The compass goes completely bonkers once I tilt the copter by more than a few degrees. Any ideas?

Katch
Posts: 280
Joined: Thu Aug 04, 2011 1:44 pm

Re: MAG sensor orientation - how?

Post by Katch »

Tommie wrote:I am having the same issues. The compass goes completely bonkers once I tilt the copter by more than a few degrees. Any ideas?


Some sort of electromagnetic interference. I get this on 3 out of 4 MWC flight controllers I own.

The best one has the IMU mounted on 8mm nylon pillars over the top of the FC. Try getting a little more distance between the frame and the mag if possible in your setup.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MAG sensor orientation - how?

Post by Tommie »

I placed the sensor about 4cm away from the board, still tiling the copter makes the MAG go crazy. I also tried calibrating it several times, without any success however.

Katch
Posts: 280
Joined: Thu Aug 04, 2011 1:44 pm

Re: MAG sensor orientation - how?

Post by Katch »

Tommie wrote:I placed the sensor about 4cm away from the board, still tiling the copter makes the MAG go crazy. I also tried calibrating it several times, without any success however.


try it on a longer lead well away from frame an power source. If it still plays up you could have a duff sensor.

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: MAG sensor orientation - how?

Post by LenzGr »

Tommie wrote:I placed the sensor about 4cm away from the board, still tiling the copter makes the MAG go crazy. I also tried calibrating it several times, without any success however.

What exactly do you mean by "MAG going crazy"? Do you see noise on the three axis? Or is the compass simply spinning quickly and no longer indicating the proper orientation? Is the compass code actually tilt-compensated to cope with this?

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MAG sensor orientation - how?

Post by Tommie »

The compass deviates from the original direction. But I found the issue, changing the direction of the MAGs Z axis fixed it.

Post Reply