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

Microstrain7 Initial Support #25579

Merged
merged 5 commits into from
Dec 5, 2023
Merged

Microstrain7 Initial Support #25579

merged 5 commits into from
Dec 5, 2023

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented Nov 18, 2023

Purpose

This forms initial support for the MicroStrain 3DM-GQ7 EAHRS system. It's "working on the bench". I've updated this to also include the simulator.

What's different from MicroStrain5

  • Dual GNSS antenna support with new messages available on the GQ7
  • Minimal refactor to improve shared code between MicroStrain5 and MicroStrain7
  • Improved state machine for health reporting based on device health rather than message frequency
  • The chosen set of messages are endorsed by MicroStrain

Manual Testing

So far, bench testing the driver against hardware. There are a few more things I'd like to do (in follow up PR) prior to flight testing. It would be nice to get this minimum version in to avoid major merge conflicts.

Automated Testing

Autotest is included.

Set up

Use MicroStrain Sensor Connect and configure these data rates and channels manually:
image

Demo Logs with bench hardware

$ ./Tools/autotest/sim_vehicle.py -v Plane -A "--serial3=uart:/dev/3dm-gq7" -DG
...

BUILD SUMMARY
Build directory: /home/ryan/Dev/ros2_ws/src/ardupilot/build/sitl
Target         Text (B)  Data (B)  BSS (B)  Total Flash Used (B)  Free Flash (B)  External Flash Used (B)
---------------------------------------------------------------------------------------------------------
bin/arduplane   4954805    187960   213160               5142765  Not Applicable  Not Applicable         

Build commands will be stored in build/sitl/compile_commands.json
'build' finished successfully (3.573s)
SIM_VEHICLE: Using defaults from (Tools/autotest/models/plane.parm)
SIM_VEHICLE: Run ArduPlane (gdb)
SIM_VEHICLE: "/home/ryan/Dev/ros2_ws/src/ardupilot/Tools/autotest/run_in_terminal_window.sh" "ArduPlane (gdb)" "gdb" "-x" "/tmp/tmpwnj65h0c" "--args" "/home/ryan/Dev/ros2_ws/src/ardupilot/build/sitl/bin/arduplane" "-S" "--model" "plane" "--speedup" "1" "--slave" "0" "--serial3=uart:/dev/3dm-gq7" "--defaults" "Tools/autotest/models/plane.parm" "--sim-address=127.0.0.1" "-I0"
SIM_VEHICLE: Run MavProxy
SIM_VEHICLE: "mavproxy.py" "--out" "127.0.0.1:14550" "--master" "tcp:127.0.0.1:5760" "--sitl" "127.0.0.1:5501"
RiTW: Starting ArduPlane (gdb) : gdb -x /tmp/tmpwnj65h0c --args /home/ryan/Dev/ros2_ws/src/ardupilot/build/sitl/bin/arduplane -S --model plane --speedup 1 --slave 0 --serial3=uart:/dev/3dm-gq7 --defaults Tools/autotest/models/plane.parm --sim-address=127.0.0.1 -I0
Connect tcp:127.0.0.1:5760 source_system=255
[Errno 111] Connection refused sleeping
Log Directory: 
Telemetry log: mav.tlog
Waiting for heartbeat from tcp:127.0.0.1:5760
MAV> Detected vehicle 1:1 on link 0
online system 1
INITIALISING> Mode INITIALISING
AP: ArduPlane V4.5.0-dev (30b66ecb)
AP: 1335a96389cc4630a4ec6b8290ea9cdc
Received 1388 parameters (ftp)
Saved 1388 parameters to mav.parm
AP: Initialising ArduPilot
AP_Logger_File: buffer size=204800
AP: MicroStrain7 ExternalAHRS initialised
AP: Ground start
AP: Skipping INS calibration
AP: Calibrating barometer
MANUAL> Mode MANUAL
AP: Barometer 1 calibration complete
AP: Barometer 2 calibration complete
AP: Barometer 3 calibration complete
AP: Airspeed 1 calibration started
AP: ArduPilot Ready
AP: AHRS: DCM active
AP: GPS 1: specified as ExternalAHRS
AP: Field Elevation Set: 1681m
Flight battery warning
GPS lock at 0 meters
AP: EKF2 IMU0 MAG0 initial yaw alignment complete
AP: EKF2 IMU1 MAG0 initial yaw alignment complete
Received 1394 parameters
Saved 1388 parameters to mav.parm
AP: EKF3 IMU0 initialised
AP: EKF3 IMU1 initialised
AP: Airspeed 1 calibrated
AP: EKF3 IMU0 tilt alignment complete
AP: EKF3 IMU1 tilt alignment complete
AP: EKF3 IMU0 MAG0 initial yaw alignment complete
AP: EKF3 IMU1 MAG0 initial yaw alignment complete
AP: EKF2 IMU0 tilt alignment complete
AP: EKF2 IMU1 tilt alignment complete
AP: EKF2 IMU0 origin set
AP: EKF2 IMU1 origin set
AP: EKF3 IMU0 origin set
AP: EKF3 IMU1 origin set
AP: EKF3 IMU0 is using GPS
AP: EKF3 IMU1 is using GPS
AP: PreArm: Gyros not calibrated
AP: EKF2 IMU0 is using GPS
AP: EKF2 IMU1 is using GPS
AP: PreArm: Gyros not calibrated
Flight battery 100 percent
AP: PreArm: Gyros not calibrated
AP: PreArm: Gyros not calibrated
Flight battery 100 percent

@Ryanf55 Ryanf55 added the FlightTest PRs to flight test (please) label Nov 21, 2023
@Ryanf55 Ryanf55 marked this pull request as ready for review November 22, 2023 03:00
@Ryanf55 Ryanf55 removed the FlightTest PRs to flight test (please) label Nov 22, 2023
@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Nov 22, 2023

Craig can't fly this for a while, so I propose a merge to master without flight test. I've done sufficient bench testing and have more improvements. Can we get this in so I don't have to worry about conflicts?

Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

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

what happens if you select both Microstrain 5 AND 7 as build options?
do we need extract_features updates?
I assume the version is auto-detected because there is only one type for Microstrains


{
AP_ExternalAHRS::ins_data_message_t ins {
accel: imu_data.accel,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Any idea why astyle is ruining the indent here? This is what astyle is automatically doing with the code.

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Nov 22, 2023

what happens if you select both Microstrain 5 AND 7 as build options? do we need extract_features updates? I assume the version is auto-detected because there is only one type for Microstrains

Not sure. In SITL they are both active.

For extract_features, there is no precedent to expose microstrain 5 series driver. Should I add them both?

@Hwurzburg
Copy link
Collaborator

for every build option, the feature must be in extract features so as to list the feature or not

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Nov 22, 2023

for every build option, the feature must be in extract features so as to list the feature or not

Awesome Henry, thanks for the clarification. I'll add it in.

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Nov 25, 2023

extract_features

It's already handled in extract_features.py. Since I followed the format in build_options.py for the 5-series, it will show up automatically.
image

Feature('AHRS', 'AHRS_EXT', 'HAL_EXTERNAL_AHRS_ENABLED', 'Enable External AHRS', 0, None),
Feature('AHRS', 'AHRS_EXT_MICROSTRAIN5', 'AP_EXTERNAL_AHRS_MICROSTRAIN5_ENABLED', 'Enable MICROSTRAIN 5-series External AHRS', 0, "AHRS_EXT"), # noqa: E501
Feature('AHRS', 'AHRS_EXT_VECTORNAV', 'AP_EXTERNAL_AHRS_VECTORNAV_ENABLED', 'Enable VectorNav External AHRS', 0, "AHRS_EXT"), # noqa

('AP_EXTERNAL_AHRS_{type}_ENABLED', r'AP_ExternalAHRS_{type}::healthy\b',),

* Implement filter state without relying on GPS
* Implement health and initialization check based on filter state
* Fix pre-arm checks missing version
* Add version specifics to microstrain 5 log msgs
* Add utilities to microstrain packet to remove magic number array
  access

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
* The old descriptor is deprecated

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>
@tridge tridge merged commit fadedbb into ArduPilot:master Dec 5, 2023
87 checks passed
@rmackay9
Copy link
Contributor

This had the 4.5 backport label but was not in the 4.5 backports project. We need to keep these two methods consistent. I think we should use the 4.5 project to indicate the PR should be backported.. not the label.

@rmackay9
Copy link
Contributor

OK, I see what's happened. The "For-4.5" label was added before we branched for 4.5. Adding this label is not necessary in this situation because everything that is included in master is included when we branch.

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Apr 27, 2024

OK, I see what's happened. The "For-4.5" label was added before we branched for 4.5. Adding this label is not necessary in this situation because everything that is included in master is included when we branch.

Thanks for the details, sorry for the confusion.

@Ryanf55 Ryanf55 deleted the microstrain7 branch April 27, 2024 16:11
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.

None yet

5 participants