-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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
base: master
Are you sure you want to change the base?
Changes from all commits
a48c49f
ca90b8f
621d017
82eee36
bec42eb
d8a3d16
04f18ef
252256e
20d9f5b
d68b1bf
e7e6819
c97d76a
f59b5c9
25e2a6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include "Copter.h" | ||
|
||
#include <AP_Gripper/AP_Gripper.h> | ||
#include <AP_InertialSensor/AP_InertialSensor_rate_config.h> | ||
|
||
/* | ||
This program is free software: you can redistribute it and/or modify | ||
|
@@ -1232,6 +1233,22 @@ const AP_Param::GroupInfo ParametersG2::var_info2[] = { | |
// @User: Advanced | ||
AP_GROUPINFO("FS_EKF_FILT", 8, ParametersG2, fs_ekf_filt_hz, FS_EKF_FILT_DEFAULT), | ||
|
||
#if AP_INERTIALSENSOR_FAST_SAMPLE_WINDOW_ENABLED | ||
// @Param: FSTRATE_ENABLE | ||
// @DisplayName: Enable the fast Rate thread | ||
// @Description: Enable the fast Rate thread | ||
// @User: Advanced | ||
// @Values: 0:Disabled,1:Enabled-Dynamic,2:Enabled-FixedWhenArmed,3:Enabled-Fixed | ||
AP_GROUPINFO("FSTRATE_ENABLE", 9, ParametersG2, att_enable, 0), | ||
|
||
// @Param: FSTRATE_DIV | ||
// @DisplayName: Fast rate thread divisor | ||
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. Is there an easier way? 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. add the value to the used value |
||
// @Description: Fast rate thread divisor used to control the maximum fast rate update rate. The actual rate is the gyro rate divided by this value. | ||
// @User: Advanced | ||
// @Range: 1 10 | ||
AP_GROUPINFO("FSTRATE_DIV", 10, ParametersG2, att_decimation, 1), | ||
#endif | ||
|
||
// ID 62 is reserved for the AP_SUBGROUPEXTENSION | ||
|
||
AP_GROUPEND | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ void Copter::auto_disarm_check() | |
} | ||
|
||
// motors_output - send output to motors library which will adjust and send to ESCs and servos | ||
void Copter::motors_output() | ||
void Copter::motors_output(bool full_push) | ||
{ | ||
#if ADVANCED_FAILSAFE | ||
// this is to allow the failsafe module to deliberately crash | ||
|
@@ -181,7 +181,19 @@ void Copter::motors_output() | |
} | ||
|
||
// push all channels | ||
SRV_Channels::push(); | ||
if (full_push) { | ||
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. Needs a comment 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. It's a shame that the copter code needs to worry about the detail of which push() to call. The copter code essentially knows that the SRV_Channels cannot do what we want it to. It would be nicer if the SRV_Channel::push() call could figure that out itself somehow |
||
SRV_Channels::push(); | ||
} else { | ||
hal.rcout->push(); | ||
} | ||
} | ||
|
||
// motors_output from main thread | ||
void Copter::motors_output_main() | ||
{ | ||
if (!using_rate_thread) { | ||
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. how does this affect servos? |
||
motors_output(); | ||
} | ||
} | ||
|
||
// check for pilot stick input to trigger lost vehicle alarm | ||
|
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.
add a comment - "don't delete"