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: run rate loop at full filter rate in its own thread #27029

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

Conversation

andyp1per
Copy link
Collaborator

@andyp1per andyp1per commented May 9, 2024

This is a redo of #26189

I have squashed the commits, rebased and started fixing the underlying problems. There were some fundamental problems with how the original PR was handling attitude control changes so I thought it was better to just open a new PR.

Support is enabled by setting:

FLIGHT_OPTIONS = 8

which gives a variable attitude rate depending on load, and:

FLIGHT_OPTIONS = 16

which gives an attitude rate locked to the gyro rate

ArduCopter/Attitude.cpp Outdated Show resolved Hide resolved
libraries/AC_PID/AC_PID.cpp Outdated Show resolved Hide resolved
@andyp1per andyp1per added the WIP label May 10, 2024
@andyp1per andyp1per force-pushed the pr-fast-rate-thread branch 2 times, most recently from a8968b0 to 9efe392 Compare May 20, 2024 20:24
tridge and others added 5 commits May 21, 2024 18:25
control notch update with using_rate_thread
allows the rate thread to trigger pulses
push up RCOutput thread priority to be above main thread
ensure SPI thread does not get de-prioritized by rate thread

Co-authored-by: Andy Piper <[email protected]>
@andyp1per andyp1per force-pushed the pr-fast-rate-thread branch 2 times, most recently from 00797c6 to fdd143b Compare May 22, 2024 16:43
tridge and others added 7 commits May 22, 2024 20:07
run motors output at rate thread loop rate
added flight_option_is_set()
allow rate thread to be enabled/disabled at runtime for in-flight impact testing
use dt_avg for rate loop dt this better reflects the actual dt between IMU samples
setup the right PID notch sample rate when using the rate thread the PID notches
 run at a very different sample rate
call update_dynamic_notch_at_specified_rate() in rate thread
log RTDT messages to track rate loop performance
set dt each cycle of the rate loop thread
run rate controller on samples as soon as they are ready
detect overload conditions in both the rate loop and main loop
decimate the rate thread if the CPU appears overloaded
decimate the gyro window inside the IMU
add in gyro drift to attitude rate thread

Co-authored-by: Andy Piper <[email protected]>
configure rate loop buffer based on AP_INERTIALSENSOR_RATE_LOOP_WINDOW_ENABLED
add condition/wait mutex primitive
configure thread priorities based on HAL_INS_RATE_LOOP
configure rate loop based on AP_INERTIALSENSOR_RATE_LOOP_WINDOW_ENABLED
configure rate loop via HAL_INS_RATE_LOOP
add set_periodic_minimum() to WSPIDevice
@andyp1per
Copy link
Collaborator Author

Flow today on top of 4.5 - working well.

@andyp1per andyp1per linked an issue May 26, 2024 that may be closed by this pull request
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.

Run rate controller at full gyro rate
3 participants