I am using pixhawk 3 pro with an external GPS running on PX4 firmware.
I am facing mag sensor inconsistency even after calibrating the pixhawk multiple times. Hence I decided to disable the internal compasses so that I could arm the drone.
Based on this post(PixRacer - 3 compasses (external, 2x internal)?), my understanding is that Mag0 is the external compass by default. Hence I re-installed the firmware. Enabled the Mag0 with ‘No Rotation’ and also set it as the Primary magnetometer. Mag1,Mag2 and Mag3 were disabled by setting the parameter CAL_MAGx_EN as DISABLED, where x is 1,2 or 3.
This yielded a working set-up where I could arm the drone and the compass was pointing in the right direction. However, the next time, I switch on the pixhawk, I now find that there has been an automatic switch. Mag0 is set to Internal Mag which is ENABLED. Mag1 is set as NO ROTATION which is disabled and the compass direction in the flight mode display is wrong. Also Mag2 and Mag does not even have a CAL_MAGx_EN parameter to disable it. The Primary Mag is still set to Mag0. So I do the correction of setting the Mag0 back to external(NO ROTATION) and Mag1 to Internal Mag.
The airframe I am using is Traxxas Stampede vxl 2wd. Even though I am able to arm the drone, due to this compass issue, the direction of the compass shown in the map is wrong and it results in the wrong direction of motion while we try navigating from one waypoint to another.
This issue has happened multiple times. I am not sure what is causing this. I would really appreciate if someone could point out what I am doing wrong and how this issue can be resolved.
Please find attached the pic of the parameter set of the mags.
What type of external gps are you using?
How is it mounted in regards to the pixhawk unit?
Have you tried your tests outdoors?
What firmware version you are using?
I have had many issues with pixhawk 3 pro magnetometer myself - that’s why all the questions. I know for fact your procedure would work with a pixhawk 4.
Thank you for your reply.
Reg your questions:
I am using Sirius RTK GPS (Ublox NEO-M8N + LIS3MDL Magnetometer)
The pixhawk is kept in a box and the external gps is mounted on a gps mount outside the box at small height from the box(based on length limit of the gps wire).
Yes. The testing was done outdoors but this flipping still happens.
I am using PX4 firmware version 1.8.0.
What do you think could be causing this issue?
I have a suspicion that it is related to the device ID of the external/internal compasses.
Is there a way to see the device ID of the external and internal compasses other than in the parameters section?
I agree with you - must be a device Id issue. I personally don’t know of any way to view those besides parameters. Have you tried enabling only one of the compasses at a time - just to make sure you can at least get just one working. Maybe try a different gps-compass module, just to make sure there are no issues with the actual pixhawk board…
One more thing, pixhawk 3 pro has an internal lis3mdl compass so I think it may be conflicting with your external one…
Hello, As you mentioned about Traxxas rover frame, can you use the rover airframe with firmware version 1.8.0 ? i ask because i can not get any PWM output from pixhawk to control throttle and steering when armed. Did you face this problem?
Do you try to adjust EKF magnetometer param? I think it could help you deal with mag inconsistent.
Great to see your reply. Actually, the problem you mentioned, I had faced in ardupilot(rover airframe). I am suspecting the configuration of rover airframe might be somehow different from normal. I haven’t tried rover airframe in px4. I will try and get back to you soon.
Could you specify which parameter correspond to EKF magnetometer? I am not sure I understand the parameter to be adjusted and by how much.
Thank you very much for the reply. I will try changing the COM_ARM_MAG limits then. Most often, I have the correct heading now after few calibrations. But midway during navigation, the compass flips sometimes and gets confused about the heading.
Also I get a accel read error sometimes. Then I switch off and then switch on the pixhawk again which temporarily resolves the issue. Do you/does anyone know a permanent fix for this as this has happened a couple of times?
Do you think this problem come from hardware? Do you have another board to test? Becuase I never found this problem on my pixhawk 3 pro with RTK GPS.
Thanks for your insight.
I have a suspicion that the power source(battery) might be causing interference more than I expected. Is there a particular way to shield the compass(internal) from the power source? Especially when you are looking for a compact system?
Try twisting the power wires. That helps to cancel out any magnetic field it generates. You can also try wrapping it with copper tape (same as what they use in electric guitars).
hi pixhawk can you send the file px4_fmu-v4pro_default.px4 of px4 1.6.5 version.
hi saengphet, pixhawk can you send the file px4_fmu-v4pro_default.px4 of px4 1.6.5 version.