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

Copter: use Auxiliary function to control adjusting of AHRS trim from RC inputs #28881

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

Conversation

peterbarker
Copy link
Contributor

This PR replaces #21861 , which removed the "auto_trim" function entirely. Turns out people do use the feature....

From that PR:

Move this feature to an RC switch and remove the stick gesture initiation

Done, new RC aux option 182

Ask Michael Oborne to add an easy aux function page to MP to allow users to easily trigger this function (and any other > available function) without needing to setup and RC switch (https://github.com/ArduPilot/MissionPlanner/issues/2957)

Done long ago

Allow this feature to be run from AltHold

Done

maybe change the feature to be run in other flight modes (like Loiter) and take the trim adjust from the lean angle of the vehicle instead of from the pilot input. This would need to not be an instantaneous capture of the lean angles but instead a filtered value taken over 10sec

That's a significant change in behaviour, virtually unrelated to the RC-based option. There's many questions around doing this sort of thing in loiter - estimatesd-position drift over time and wind come to mind.... perhaps a future enhancement :-)

New semantics are that if you flick the switch on while you are flying it will start to trim. If the vehicle lands, or you change modes to something other than STABILIZE/ALT_HOLD the trimming is stopped. If you flick the switch back to low while flying then the trimming is stopped and the current trims saved.

I've also allowed the feature to be compiled out (about 384 bytes). We should probably compiled it out of toy mode (skyviper) as it already has some magic stick calibration stuff in it.

I've written an autotest for it.

Board               AP_Periph  blimp  bootloader  copter  heli  iofirmware  plane  rover  sub
CubeRedPrimary                 *      *           -24     -16               *      *      *
Durandal                       *      *           -32     -64               *      *      *
Hitec-Airspeed      *                                                                     
KakuteH7-bdshot                *      *           8       8                 *      *      *
MatekF405                      *      *           0       -24               *      *      *
Pixhawk1-1M-bdshot             *                  -24     -24               *      *      *
f103-QiotekPeriph   *                                                                     
f303-Universal      *                                                                     
iomcu                                                           *                         
revo-mini                      *      *           8       -64               *      *      *
skyviper-journey                                  -16                                     
skyviper-v2450                                    24                                      

Needs a flight test.

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Dec 16, 2024
LOGGER_WRITE_EVENT(LogEvent::SAVE_TRIM);
gcs().send_text(MAV_SEVERITY_INFO, "Trim saved");
}

#if AP_COPTER_AHRS_AUTO_TRIM_ENABLED

void RC_Channels_Copter::do_aux_function_ahrs_auto_trim(const RC_Channel::AuxSwitchPos ch_flag)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's put a comment above this function to explain what it's doing. Somethjing like, "start/stop ahrs auto trim"

@@ -46,6 +46,17 @@ class RC_Channels_Copter : public RC_Channels
// returns true if throttle arming checks should be run
bool arming_check_throttle() const override;

// support for trimming AHRS using RC stick inputs:
Copy link
Contributor

Choose a reason for hiding this comment

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

need to update the comment? perhaps just replace "RC stick inputs:" with "an auxiliary function"

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.

3 participants