-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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 #26189
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0a09fc7
AC_AttitudeControl: hacks for copter with separate rate thread
tridge b1b7910
AP_InertialSensor: hacks for copter with separate rate thread
tridge 0c3cb2a
Copter: hacks for copter with separate rate thread
tridge ada9b40
Copter: run motors output at rate thread loop rate
tridge 9945927
HAL_ChibiOS: trigger DShot for high priority threads
tridge 8797d06
AC_AttitudeControl: fixed non-multicopter build
tridge 1c44b8a
HAL_ChibiOS: tweak thread priorities
tridge 845bd64
Copter: added flight_option_is_set()
tridge 2c22ac1
Copter: allow rate thread to be enabled/disabled at runtime
tridge ac60cf0
Copter: use dt_avg for rate loop dt
tridge 3edb952
Copter: fixed dt_avg on re-enable
tridge df75860
Copter: setup the right PID notch sample rate
tridge 27bb746
AP_Vehicle: expose update_dynamic_notch_at_specified_rate
tridge 445b46c
Copter: call update_dynamic_notch_at_specified_rate() in rate thread
tridge 71baf90
AP_Vehicle: control notch update with using_rate_thread
tridge d9d3377
Copter: move using_rate_thread to AP_Vehicle
tridge 3e9a51b
Copter: fixed motor test with rate thread
tridge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,15 +113,15 @@ const AP_Scheduler::Task Copter::scheduler_tasks[] = { | |
// update INS immediately to get current gyro data populated | ||
FAST_TASK_CLASS(AP_InertialSensor, &copter.ins, update), | ||
// run low level rate controllers that only require IMU data | ||
FAST_TASK(run_rate_controller), | ||
FAST_TASK(run_rate_controller_main), | ||
#if AC_CUSTOMCONTROL_MULTI_ENABLED == ENABLED | ||
FAST_TASK(run_custom_controller), | ||
#endif | ||
#if FRAME_CONFIG == HELI_FRAME | ||
FAST_TASK(heli_update_autorotation), | ||
#endif //HELI_FRAME | ||
// send outputs to the motors library immediately | ||
FAST_TASK(motors_output), | ||
FAST_TASK(motors_output_main), | ||
// run EKF state estimator (expensive) | ||
FAST_TASK(read_AHRS), | ||
#if FRAME_CONFIG == HELI_FRAME | ||
|
@@ -674,11 +674,22 @@ void Copter::one_hz_loop() | |
AP_Notify::flags.flying = !ap.land_complete; | ||
|
||
// slowly update the PID notches with the average loop rate | ||
attitude_control->set_notch_sample_rate(AP::scheduler().get_filtered_loop_rate_hz()); | ||
if (!using_rate_thread) { | ||
attitude_control->set_notch_sample_rate(AP::scheduler().get_filtered_loop_rate_hz()); | ||
} | ||
pos_control->get_accel_z_pid().set_notch_sample_rate(AP::scheduler().get_filtered_loop_rate_hz()); | ||
#if AC_CUSTOMCONTROL_MULTI_ENABLED == ENABLED | ||
custom_control.set_notch_sample_rate(AP::scheduler().get_filtered_loop_rate_hz()); | ||
#endif | ||
|
||
// see if we should have a separate rate thread | ||
if (!started_rate_thread && flight_option_is_set(FlightOptions::USE_RATE_LOOP_THREAD)) { | ||
if (hal.scheduler->thread_create(FUNCTOR_BIND_MEMBER(&Copter::rate_controller_thread, void), | ||
"rate_controller", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please can we shorten the thread name as it gets truncated in |
||
2048, AP_HAL::Scheduler::PRIORITY_BOOST, 1)) { | ||
started_rate_thread = true; | ||
} | ||
} | ||
} | ||
|
||
void Copter::init_simple_bearing() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.