Skip to content

Add get_roll_deg, get_pitch_deg and get_yaw_deg to AHRS interface, start using them #28010

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

peterbarker
Copy link
Contributor

@peterbarker peterbarker commented Sep 4, 2024

Replace with get_roll_rad and get_roll_deg`, both floats.

Now just adds get_roll_deg() etc.; renaming get_roll_rad (etc.) costs over 400 bytes on CubeOrange!

@peterbarker peterbarker added the WIP label Sep 4, 2024
@peterbarker peterbarker changed the title Remove roll_sensor/pitch_sensor/yaw_sensor from AP_AHRS Add get_roll_deg, get_pitch_deg and get_yaw_deg to ARHS interface, start using them May 29, 2025
@peterbarker
Copy link
Contributor Author

I've simplified this PR to simply add the new methods to the interface, not touching the existing creation of the yaw_sensor variables etc.

I'm also not renaming (eg.) get_roll to get_roll_rad in this PR now. This rename costs us 408 bytes on CubeOrange because scripting needs the old binding to exist or we instantly break way too many scripts. We also can't deprecate an alias, it seems. We might still choose to do this in the future (I have the patches :-), but not in this PR.

@peterbarker
Copy link
Contributor Author

peterbarker commented May 29, 2025

Board                    AP_Periph  blimp  bootloader  copter  heli  iofirmware  plane  rover  sub
CubeOrange-periph-heavy  *                 *
CubeRedPrimary                      -80    *           -168    -184              -32    -88    -64
Durandal                            -40    *           -64     -80               -40    -104   40
Hitec-Airspeed           *                 *
KakuteH7-bdshot                     -48    *           -144    -136              72     -96    -216
MatekF405                           -32    *           -56     -48               -88    -32    -8
Pixhawk1-1M-bdshot                  8                  -40     -40               -64    -24    8
f103-QiotekPeriph        *                 *
f303-Universal           *                 *
iomcu                                                                *
revo-mini                           -32    *           -104    -88               -72    -112   -72
skyviper-journey                                       -104
skyviper-v2450                                         -24

... there's still a bit of low-hanging fruit, too.

@@ -7390,7 +7388,7 @@ void GCS_MAVLINK::send_high_latency2() const
global_position_current.lng, // [degE7] Longitude
global_position_current.alt * 0.01f, // [m] Altitude above mean sea level
high_latency_target_altitude(), // [m] Altitude setpoint
(((uint16_t)ahrs.yaw_sensor / 100) % 360) / 2, // [deg/2] Heading
uint16_t(ahrs.get_yaw_deg()) / 2, // [deg/2] Heading
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should probably be changed to do floating-point division and rounding? Pre-existing problem.

@peterbarker peterbarker marked this pull request as ready for review May 29, 2025 03:36
@peterbarker
Copy link
Contributor Author

.... there's a bug in toy_mode.cpp line 294 which we should fix once this is in.

@peterbarker peterbarker changed the title Add get_roll_deg, get_pitch_deg and get_yaw_deg to ARHS interface, start using them Add get_roll_deg, get_pitch_deg and get_yaw_deg to AHRS interface, start using them May 31, 2025
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