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

Refactor microstrain to common library #24723

Merged

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented Aug 21, 2023

This refactors out out the common shared logic from microstrain series 5 and 7 (mainly, the parsing). This will allow creating the 7-series driver with far less code duplication. Logic was not impacted. On SITL, I just renamed the class to make it clear it's a simulator for the 5-series. The 7-series uses some different packets, and also has two GPS instances.

https://ardupilot.org/copter/docs/parameters.html#gps-type

https://ardupilot.org/copter/docs/common-external-ahrs.html

param set GPS_TYPE 21
param set AHRS_EKF_TYPE 11
param set EAHRS_TYPE 2
param set SERIAL4_PROTOCOL 36
param set SERIAL4_PROTOCOL 115

https://github.com/ardupilot/ardupilot/blob/master/libraries/SITL/SIM_MicroStrain.h#L3

Test:

  • autotest.py build.Plane test.Plane.MicroStrainEAHRS --debug
  • sim_vehicle.py -v Plane -DG --console --map -A --uartE=sim:MicroStrain
    • With GDB breakpoint: sim_vehicle.py -v Plane -DG --console -A --uartE=sim:MicroStrain -B AP_ExternalAHRS_MicroStrain5.cpp:98

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

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

I'd prefer libraries/AP_ExternalAHRS/MicroStrain_common.{cpp,h}

@Ryanf55 Ryanf55 force-pushed the refactor-microstrain-to-common-library branch from 6f92260 to 843036d Compare August 23, 2023 03:18
@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Aug 23, 2023

I'd prefer libraries/AP_ExternalAHRS/MicroStrain_common.{cpp,h}

Done!

@Ryanf55 Ryanf55 requested a review from tridge August 23, 2023 03:19
@Ryanf55 Ryanf55 force-pushed the refactor-microstrain-to-common-library branch from 843036d to 196501c Compare August 27, 2023 23:22
@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Aug 28, 2023

I saw that SITL tests failed. After fixing my local dev environment, I was able to reproduce this failure locally and will be working on it. It's likely caused by the serial port not being set up.
image

* Move common parsing to MicroStrain_common
* Add propogation of parsed packet type back to the driver
* Rename the driver to add series-5 specifier
* Unlocks adding 7-series driver with less code duplication
* Add missing includes

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Aug 28, 2023

test.Rover.Rally has failed 3x in a row in CI and is blocking merge.

@tridge tridge merged commit 461a8dc into ArduPilot:master Aug 29, 2023
83 of 84 checks passed
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.

3 participants