Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check mag sensor for consistency before flight #8039

Merged
merged 3 commits into from
Oct 5, 2017

Conversation

priseborough
Copy link
Contributor

Many vehicle have multiple magnetometers fitted which are all calibrated by default and which can all be used by the sensor selection logic. Checking the sensors for consistency will prevent takeoff if one of the sensors has an invalid calibration or if the orientation is set incorrectly.

Potential issues with this solution that need resolving are:

  1. Ground based magnetic anomalies will cause this check to fail when sensors are not co-located. We need a way to inform the user that the first cation is to pick up the vehicle to clear the check. This will require the pass to latch.

  2. One sensor may have issues that prevent it being successfully calibrated or used. We need to provide a way that users can prevent a problem sensor being used by this and the selection algorithm.

@priseborough
Copy link
Contributor Author

Testing on a pixracer with external GPS and compass showed that this prevented checks passing when the external compass orientation was set incorrectly to 90 deg yaw. Messaging to users needs further work to reduce frustration.


float mag_diff_sum_sq = 0.0f; // sum of differences squared for a single sensor comparison against the primary

// calculate gyro_diff_sum_sq for the specified sensor against the primary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gyro comment

@dagar
Copy link
Member

dagar commented Oct 2, 2017

Thanks, this will help catch some of these sensor issues.

Beyond user frustration I'm not sure there's actually enough in a default log to further investigate when there is a problem. For example the pixhawk 2.1 I was using today has 4 mags (1 external, 3 internal). One of the internal mpu9250s reports as external because it's using the same bus that was external on a pixhawk 1.

For per mag disabling what do you think about handling it alongside the calibration parameters?
CAL_MAGX_DISABLED
The driver would still run, publish, and be included in calibration, but sensors would skip it for voting, and

Then if we had some simple messages about the specific problematic mag it would map back to params. The actual threshold check and error reporting could move to the sensors module and the publication used by commander could simply be a high level sensor status message.

dagar
dagar previously approved these changes Oct 2, 2017
@dagar dagar added this to the Release v1.7.0 milestone Oct 5, 2017
@dagar
Copy link
Member

dagar commented Oct 5, 2017

Fixed gyro comment.

@dagar dagar merged commit 0def4ac into PX4:master Oct 5, 2017
@priseborough priseborough deleted the pr-preFltMagChk branch October 9, 2017 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants