Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iNav 2.6 aligning magnetometer(a compass)
#31
The sensors tab is showing you the raw output from the magnetometer. The setup tab is showing you the heading calculated by iNav, combining data from the gyro on the flight controller and the magnetometer. For this to work, both compass and FC need to be moving together, with the alignment set properly, and both sensors calibrated.

What exactly is the issue now?
Reply
Login to remove this ad | Register Here
#32
I noticed that when I tip my wing right and left the heading changes I can get it to come up with 0° but then if it tips it changes. Is that normal?
Reply
#33
(15-Jan-2021, 06:10 PM)jimv Wrote: I noticed that when I tip my wing right and left the heading changes I can get it to come up with 0° but then if it tips it changes. Is that normal?

Hi jimv.

Yes, if you are in front of a monitor, it's normal. Magnetic compass is very sensitive device, Earth's magnetic field strength is only around 50 uT, which is very small, compared to a your average NdFeB fridge magnet which has magnetic field strength somewhere around 500mT (10000 times stronger!).

I suggest you fly your wing with your current settings and calibration, and watch the OSD how the heading behaves. If it's consistent, but shifted some degrees, then land, change the align_mag_yaw value in iNav, and try again. If it's erratic, then do recalibration (preferably outside, far from anything steel, or electronic other than your wing).

Your compass has to point in the same direction as your FC, as mentioned by others already, if not, use align_mag_roll, align_mag_pitch, align_mag_yaw to cancel any axis rotation compared to your FC orientation.

Last but not least, place your compass as far away from any source of interference as possible (power wires, motors, screws, carbon frame, steel battery strap buckle?). This is almost impossible on 5 inch quad, but quite doable on a wing.
Reply
#34
So again these are the steps you need to follow for successful magnetometer calibration and alignment:
step 1. Find out how the magnetometer sensor is oriented on your board from manufacturer. For example I have M8Q-5883 GPS with magnetometer from Matek, where magnetometer (compass) is mounted CW270FLIP. Let's remember that.

step 2. So in general you would only need to set mag alignment CW270FLIP in Configuration tab / Board and sensor alignment in iNav configurator. But this is only the case if you mount your GPS/compass board flat and arrow facing forward! But let's say you mounted it with arrow facing backward, and you tilted it 30 degrees backward (because you want to have the best GPS reception when flying forward pitched 30 degrees). In this case, change mag alignment to CW0, and you need to go to CLI, and set align_mag_roll, align_mag_pitch, align_mag_yaw.
In other words, when iNav detects you have some values in align_mag_xxx variables, it will ignore align_mag value!

So for our case, we need to combine both CW270FLIP sensor orientation and our mounting position.
CW270FLIP is:
align_mag_pitch = 1800 and align_mag_yaw = 2700
combined with our mouting position (arrow facing backward and 30 degree tilt backward)
align_mag_roll=300
align_mag_pitch=1800
align_mag_yaw=900
save

step 3. Put heading into your OSD, so you can see it in your goggles. Go outside with your goggles, transmitter and quad, some distance from buildings, and metal things. Turn on the transmitter, plug-in your battery into your quad and turn on goggles. Issue stick command throttle up+yaw right+pitch down (and hold it for 1 second!). Your FC board should start blinking and in your goggles heading will display ---, signaling that compass calibration is in progress. You have 30 seconds, or whatever value you put to mag_calibration_time variable, to calibrate your compass. Rotate your quad around each axis 360 degrees, take your time.

When calibration is done (FC stops blinking, and heading in your goggles displays some number), point approximately north with the nose of your quad. THe heading should show 0 degrees. Turn east, heading should display 90 degrees, south 180, west 270. Then pitch quad's nose down 45 degrees and do the same, the heading should again display 0 (north), 90 (east), 180 (south), 270 (west). Now flip your quad upside-down, and do the same heading test. If in any of the above your heading is crap, you didn't set the correct values to align_mag_xxx variables. Re-set them and try again.

Hope this guide helps you! Happy flying.
[-] The following 1 user Likes s0lari's post:
  • V-22
Reply
#35
Hi guys, do you think it is possible to recalculate the mag adjustment values if I put the mag on a frame in a specific position (whatever, upside down, tilted, etc.) and then note the influence of drone tilting and rotating on the heading?

For example: I install a mag, calibrate, connect to configurator, face North, and tilt the drone forward 45 deg, sideways 45 deg, yaw 45 deg. Since the mag is in a deliberate position every time I pitch, roll and yaw the mag Heading will change. I note the heading for each position, put them in a say excel calculator and get the adjustment values. Is this theoretically possible?

I have a breakout mag board separate from GPS so not limited to place it only on top and would want to experiment to find the best location. Maybe the best position for a mag is not on the top but under the belly or even inside the frame.
Reply
#36
Hello all,
 

after spending a lot of time trying to figure out magnetometer orientation, I still can’t get the quad to obtain correct heading information.
Accelerometer is fine, the quad flies well in acro. The FC is rotated 180° in yaw, so the arrow is top side facing backwards.

[Image: Inav-Config.jpg]

I use a Beitian BN-383 with an integrated QMC5883L magnetometer that I took out of its plastic casing. Unfortunately, I can’t find the magnetometer alignment regarding to the GPS, but I assume it is CW270Flip, as people told me this is mostly the case. Does anybody know if this is true for this GPS unit?
I mounted the GPS as seen on the photograph, tilted 30° back and cables out to the front.

[Image: GPSMounting.jpg]

I am not sure whether the mag alignment refers to the FC (rotated 180°) or to the quad. When I refer it to the quad, as seen below, I get more or less correct heading readings when the quad is lying flat. But they still change when I pitch the quad.
 
Mag Alignment
Roll        0°
Pitch      180° (CW270Flip) - 30° (GPS tilt) = 150°
Yaw       270°(CW270Flip) + 180° (GPS rotation) = 90°


Can you guys help me out?
Reply
#37
Somehow, by trial and error I figured it out. I don't really understand it though.

With

Mag Alignment
Roll        30°
Pitch      180°
Yaw       90°

The quad holds its position alright (about +/- 2 m) and returns to home.
It would be really nice to actually understand this.
Reply
#38
D-beam
I know what you mean I got mine working but I don’t know what I did.
I now have problems with my GPS coordinates I only get degrees and minutes but that isn’t enough to find my wing I lost video and my RTH didn’t work and the coordinates was not fine enough to find my wing. my googles had degrees and it would of helped but no video so no DVR recording to look at. My Taranis radio displayed degrees and minutes only without seconds it isn’t possible. Good luck.
Reply
#39
(24-May-2021, 07:18 PM)d-beam Wrote: Somehow, by trial and error I figured it out. I don't really understand it though.

With

Mag Alignment
Roll        30°
Pitch      180°
Yaw       90°

The quad holds its position alright (about +/- 2 m) and returns to home.
It would be really nice to actually understand this.

Thanks for posting this. I've been struggling with the same problem in iNav 3.0 using an iFlight M8Q-5883 GPS+Compass, and happen to have the same setup (180 deg FC orientation, 30 deg GPS/Compass tilt). The GPS is supposed to use the usual CW270Flip, but heading changed unexpectedly upon changes in pitch or roll.

Your values worked, and I also do not understand it. CLI commands:


Code:
set align_mag_roll = 300
set align_mag_pitch = 1800
set align_mag_yaw = 900
Reply
#40
Photo 
(26-Nov-2021, 04:46 AM)jseaber Wrote: Thanks for posting this. I've been struggling with the same problem in iNav 3.0 using an iFlight M8Q-5883 GPS+Compass, and happen to have the same setup (180 deg FC orientation, 30 deg GPS/Compass tilt). The GPS is supposed to use the usual CW270Flip, but heading changed unexpectedly upon changes in pitch or roll.

Your values worked, and I also do not understand it. CLI commands:


Code:
set align_mag_roll = 300
set align_mag_pitch = 1800
set align_mag_yaw = 900
Hi,
I had a similar issue. In my quad is FC (iflight succeX-E F722- FC with iNav 4.0) rotated by 90degs, I use also NAZA GPS with integrated compass (default compass align is CW180flip). I set it in CLI accordingly, but it resulted in unstable and wrong heading values. 

After few hours of trial-and-error method I have noticed, that every board alignment value I set in CLI is added also to mag readings. I physically rotated my board by 90degs and entered in CLI set align_board = 900. I expected that when I point my quad to north, heading will be 0, but it was 90. So I compensated board alignemnt by subtracting 90degs from mag align (align_mag_yaw) and now it works fine.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  iNav on NeutronRC AT32F435 mini AIO necbot 17 1,641 20-May-2024, 09:47 AM
Last Post: jirisvabik
  Recently flashed INAV to speedybee f405 and already had issues on quad crash. grozaalex 0 333 03-May-2024, 09:25 PM
Last Post: grozaalex
  Switch from BF 4.5 RC3 to INAV Maverick 0 211 19-Apr-2024, 08:44 AM
Last Post: Maverick
  Announcement INAV 7.1 - Compass No Longer Required SnowLeopardFPV 2 728 15-Apr-2024, 10:34 PM
Last Post: SnowLeopardFPV
  inav artificial horizon offset range quinn 5 248 08-Apr-2024, 12:38 AM
Last Post: StuweFPV


Login to remove this ad | Register Here