I'm using a Pixhawk and 3DR GPS/compass module in a plane. The external compass is apparently recognized by the Pixhawk as the COMPASS_EXTERNAL is set to 1 and the DEV_ID's are recorded.
However, if the Pixhawk is rotated the heading changes, if the GPS/compass module is rotated the heading does not change. So it seems the internal compass is being used not the external (or I'm seeing the gyro affecting the heading), yet on first connect the heading is not 0 which is a sign that the compass is not working at all.
The CLI compass test shows only one set of offsets. Does this mean only one compass is being seen? It claims the external compass is being used but clearly it is not as it can be rotated in any direction without a heading change.
It's really frustrating as the MP has such limited compass tests and visualization especially for two compasses (internal and external).
Why also is my external compass not working when it is recognized by the Pixhawk, it's not the compass as I've tried 2 spare ones? The cables and plugs are also fine.
Replies
Graham, did you get to the bottom of the second compass not reporting (in Mission Planner) ?
I have the same result on a Pixhawk with Plane 3.2.3 and a genuine 3DR GPS/Compass and the latest MP.
In compass Live Calibration only the LHS xyz graphic shows any live calibration points, and after completion the config list shows no valid (non 0) offsets for Compass_OFS2_x,y,z
Regards,
Martin
PS. I do this in APM:Copter routinely and both Live displays show cal points.
Martin, did you sort this out? The times I've had the second compass not reporting was when the external compass was not actually working despite being plugged in.
Or I don't know if any other setting is required.
Hi Graham,
The answer depends on where you are getting the 'heading' from. I think the most likely reason for what you describe is that the external compass is working, but the code has detected that the compass is inconsistent with the gyroscope (as the gyro shows there is rotation happening, but the compass doesn't) and has disabled using the compass for heading.
If you post a sdcard log or tlog I should be able to tell if that is the case. A sdcard log would be best if possible. For creating the log, start by moving the pixhawk but not the external compass, then move the external compass but not the pixhawk. That should give enough information to see what is happening.
Cheers, Tridge
Hi Tridge, here's the log, rotated the Pixhawk first and then the external compass (3DR GPS/Compass module).
Graham
2014-11-06 11-25-31.bin
The log shows that both compasses are working. It has both MAG and MAG2 log messages, with both showing movement that matches your description.
The odd thing is the scale on MAG2 is huge - much larger than usual for a LSM303D compass. I suspect that may be why the compass calibration isn't working? Are you doing compass calibration with MissionPlanner?
The large scale on the 2nd mag is puzzling. I'll have a look at some other logs and see if I have that sort of scale here.
Was the Pixhawk close to anything magnetic in the test?
Cheers, Tridge
Or I don't know if any other setting is required.
Thanks Tridge, am busy getting a log right now.
Another quick question, I've been told that enabling COMPASS_LEARN would not be very effective here in South Africa as the earth's magnetic field strength is fairly weak here, is that true?
I haven't heard that before. I'd be surprised if it is true but I've never analysed a compass log for a flight in South Africa.
btw, with the EKF enabled the compass is really not important for a fixed wing plane once it has taken off. All it is used for is initial yaw on the ground. Once the plane is flying the EKF can get yaw much more accurately with GPS and accelerometers.
Cheers, Tridge
Saw your comments in the OBC analysis regarding the compass use, it would be great to not use compass at all.