After numerous attempts at calibrating my magnetometer, there have been no results: the GCS will show my plane as perfectly stable only to start toiletbowling seconds later. Which is what brings me to my question: how important is magnetometer calibration? Can I be off by 1-2 degrees or does it have to be dead on? Is there possible to counter it in the attitude settings (change the virtual orientation of the mag so it matches what the flight controller expects)? Any help is appreciated. Thanks in advance.

EDIT: Module is https://www.banggood.com/BS-880-Flight-Control-GPS-Module-With-HMC5883L-Electric-Compass-For-APM-2_5-2_6-pixhawk-p-995591.html?rmmds=myorder

f5soh

  • *****
  • 3799
    • LibrePilot
Hi,

Calibration is not critical, you simply need to cover all the 3D space while calibrating. (skip first 5 steps, dance and save last step)
"mag dance" can be found in youtube videos.

Auxmag orientation will be set so the 3 bars in Attitude > Magnetometer still in phase while moving the frame.
Set the MagUsage to Auxonly before flying.



What Fusion algorithm did you use ?
Are you sure the Mag still without alarm while applying power ?

Mag settings are set to AuxOnly, the mag is green although that doesn't mean much, and I don't know what you mean by Fusion algorithm. Thanks for the quick reply.

f5soh

  • *****
  • 3799
    • LibrePilot
Config > Attitude tab > Settings > Attitude Estimation algorithm


I am currently on Complementary+GPS+Mag, but the behavior happened when INS13 was selected.

f5soh

  • *****
  • 3799
    • LibrePilot
You should not use Complementary+GPS+Mag with a fixedWing, after doing turns in Poshold the board can completely lost the orientation (due to the gravity hidden by centrifugal forces) . Additionally the 16.09 will not use the Mag as expected if Complementary+Mag** is selected.
Use INS13 instead

I don't understand what do you mean for  "my plane as perfectly stable only to start toiletbowling seconds later" assuming you are using a fixedWing.

I mean that looking at GCS with telemetry, the plane will be perfectly level for a few seconds and then the 3d model in the bottom left starts spiraling down rapidly. I also noticed that if I put the plane in any GPS flight mode, the elevons immediately went in a position to bank harshly to the right.

Is this copter? or fixed wing?  Toilet bowl is usually a description of a copter flight problem, but "plane" usually means fixed wing.

You must use INS13 in Attitude -> Settings -> AttitudeEstimationAlgoritym

FlightData page, after GPS goes green, does PFD/HUD go crazy and flip around?  If so, your GPS/mag board orientation is not mounted in the normal direction and you must tell the config what direction it is mounted (Attitude -> Magnetometer).  With this this type (I2C mag) of GPS/mag, the mag board orientation should be 0,180,0 or 180,0,180 (they are the same) when the GPS/mag is mounted pointing in the correct direction.

Battery plugged in, go to Attitude -> Magnetometer.  Rotate and flip (not too fast) the aircraft all around in all directions.  The sliders and number on the right hand side should stay centered and low, not more than say +-5.  If it is more than that, your GPS/mag board is mounted in a non-standard direction and you must figure out how it should be mounted and adjust the rotation parameters on the left side of that page.  You probably need 0,180,0

Edit: I see you mention elevons, so this must be fixed wing.  :)

f5soh

  • *****
  • 3799
    • LibrePilot
For fixed wing the position hold is done doing turns so banking at some point is normal.

Quote
the plane will be perfectly level for a few seconds and then the 3d model in the bottom left starts spiraling down rapidly.

Is that on ground ?
The board can be affected by vibrations, especially with complementary (again, please do not use)
Use INS13, double check the Auxmag orientation using the 3 bars as shown in previous video.

So, I just watched the video that f5soh suggested and I did not set my home position to the right height before calibration beforehand which could cause problems... Mag orientation may also be an issue because I do remember the bars in Attitude > Magnetometer not being all being at 0. I will redo calibration tonight with those issues fixed. And to answer f5soh's question, it was indeed on ground with the aircraft disarmed.

f5soh

  • *****
  • 3799
    • LibrePilot
Re: How much error can be in mag calibration (FixedWing on revolution FC)
« Reply #10 on: June 19, 2017, 07:17:01 pm »
The altitude manually set is not really important or need precision for Mag calibration.
Best way is use the GPS for HomeLocation, take a look here:
https://librepilot.atlassian.net/wiki/display/LPDOC/Setting+Home+location

Mag orientation is more critical and should be set correctly.

Be sure there is no magnet around, like lipo safer or buzzer.


Re: How much error can be in mag calibration (FixedWing on revolution FC)
« Reply #11 on: June 20, 2017, 04:42:02 pm »
Still did not get a successful mag calibration although it was a lot better. The reason behind that is because my bec overheated so I had to replace it. Another issue popped up today as I was trying to finalize the wing: the revo suddently stopped recognizing the gps. I don't understand what the issue is but the GCS now says 'no gps'.

Mateusz

  • *
  • 754
Re: How much error can be in mag calibration (FixedWing on revolution FC)
« Reply #12 on: June 20, 2017, 06:12:28 pm »
Still did not get a successful mag calibration although it was a lot better. The reason behind that is because my bec overheated so I had to replace it. Another issue popped up today as I was trying to finalize the wing: the revo suddently stopped recognizing the gps. I don't understand what the issue is but the GCS now says 'no gps'.

Probably lose connection. GPS has 4 wires, TX, RX, GND and VCC signals, TX must go to RX and RX must go to TX. You can hookup usb-serial adapter (and putty to connect to serial port COM1 with baudrate 9600) to GPS lines and see it working if you want.
Magnetometer has additional SCL and SDA lines, it does not need GND and VCC since those are already used to power GPS and magnetometer takes power from there.

You should use one of scopes to test if rotations (multiple of 90 deg) are set correctly for external magnetometer. Set one of scopes to show x,y,z for both Internal and AuxMag. When you rotate aircraft both magnetometers should show the same pattern if rotation is set correctly. Then you do calibration of both by setting to use Both magnetometers and before flying you set to use only AuxMag. The reason to set to use both when calibrating is to calibrate both, so you can see bars zeroing later on, but for flight you set use AuxOnly.

Be careful not to rip off usb connector when calibrating Mag, best is to use Oplink and doing it outdoors is a must. You can skip first 5 steps, and do all possible rotations on last one, since magnetometer calibration is continuous and it takes samples all time not only when it asks you to position aircraft. That also means you can't put it anywhere close to metalic object (like roof of the car) until whole calibration is complete.

Avoid magnets or devices that may contain magnets (buzzer, gimbal etc..) they tend to saturate magnetometer such that it's showing just one thing and noise around that. External magnetometer must be far from the high current wires, metalic objects, magnets.

f5soh

  • *****
  • 3799
    • LibrePilot
Re: How much error can be in mag calibration (FixedWing on revolution FC)
« Reply #13 on: June 20, 2017, 08:33:58 pm »
Quote
Then you do calibration of both by setting to use Both magnetometers and before flying you set to use only AuxMag. The reason to set to use both when calibrating is to calibrate both, so you can see bars zeroing later on, but for flight you set use AuxOnly.

Whatever the source selected all magnetometers are calibrated so you can set the Mag source to "AuxOnly" before calibration.
For calibration the Mag source and AuxMag orientation (physically and/or orientation numbers set in Gcs) doesn't matter.

When you get the Gps working again you can post your config file after calibration. Sometimes we can see where is the issue.