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

AP_ExternalAHRS: Add pre-arm for misconfigured EAHRS_SENSORS and GPS_TYPE #26611

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented Mar 25, 2024

Purpose

  • This catches when there's a mismatch of GPSx_TYPE and EAHRS_SENSORS when GPS is enabled
  • Before this pre-arm, failure to set GPS_TYPE2 to 21 (ExternalAHRS) resulted in silent rejection of the data in AP_GPS because the default is off
  • The wiki did not say to set GPS_TYPE on anything but the VN300
  • For now, until we support 3+ GPS instances, this only checks if you have at least on GPSx_TYPE set to EAHRS.

Drive by fix - logging problem in Microstrain7 with format strings.

Tests

Tested in SITL with MicroStrain7 hardware. And, a new CI test:

./Tools/autotest/autotest.py build.Plane test.Plane.GpsSensorPreArmEAHRS

Why?

The default behavior is to disable the 2nd GPS, so MicroStrain7 was dropping the data on the floor in the call to AP::gps().handle_external(gps, instance);

Futher improvements

The same behavior is possible with other external sensors?

@Ryanf55 Ryanf55 marked this pull request as draft March 25, 2024 02:47
@Ryanf55 Ryanf55 self-assigned this Mar 25, 2024
@Ryanf55 Ryanf55 force-pushed the eahrs-prearm-for-gps-configuration branch from 19c81e9 to d696459 Compare March 25, 2024 23:24
@Ryanf55 Ryanf55 marked this pull request as ready for review March 25, 2024 23:30
@Ryanf55 Ryanf55 force-pushed the eahrs-prearm-for-gps-configuration branch from d696459 to 79133b7 Compare March 26, 2024 00:06
@Ryanf55 Ryanf55 added the WikiNeeded needs wiki update label Mar 26, 2024
@Ryanf55 Ryanf55 changed the title AP_ExternalAHRS: Add pre-arm for misconfigured EAHRS_SENORS and GPS_TYPE AP_ExternalAHRS: Add pre-arm for misconfigured EAHRS_SENSORS and GPS_TYPE Mar 26, 2024
@Ryanf55 Ryanf55 force-pushed the eahrs-prearm-for-gps-configuration branch 2 times, most recently from 4571a24 to 905748b Compare March 26, 2024 01:30
Ryanf55 added 2 commits March 25, 2024 22:17
…TYPE

* This catches when there's a mismatch of GPSx_TYPE and EAHRS_SENSORS
  when GPS is enabled
* Before this pre-arm, failure to set GPS_TYPE2 to 21 (ExternalAHRS)
  resulted in silent rejection of the data in AP_GPS because the default
is off
* And fix a little logging bug

Signed-off-by: Ryan Friedman <[email protected]>
* And test for single GPS reporting on Microstrain7

Signed-off-by: Ryan Friedman <[email protected]>
@Ryanf55 Ryanf55 force-pushed the eahrs-prearm-for-gps-configuration branch from 905748b to 4b4ed67 Compare March 26, 2024 04:20
@Ryanf55 Ryanf55 requested a review from peterbarker April 15, 2024 23:35
@@ -50,6 +50,13 @@ class AP_ExternalAHRS_MicroStrain7: public AP_ExternalAHRS_backend, public AP_Mi
build_packet();
};

protected:

uint8_t num_gps_sensors(void) const override
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick; normally the curly bracket is on the same line as the definition in .h files. Not a blocker of course. Personally I'd put this all on one line.

@rmackay9
Copy link
Contributor

We should update this wiki page with the new error https://ardupilot.org/copter/docs/common-prearm-safety-checks.html

@tridge tridge merged commit 2c803e3 into ArduPilot:master Apr 29, 2024
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants