-
Notifications
You must be signed in to change notification settings - Fork 18.7k
AC_AttitudeControl: Add conversions from cd to rad #30120
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
base: master
Are you sure you want to change the base?
AC_AttitudeControl: Add conversions from cd to rad #30120
Conversation
|
||
input_euler_rate_roll_pitch_yaw_rads(euler_roll_rate_rads, euler_pitch_rate_rads, euler_yaw_rate_rads); | ||
} | ||
|
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.
maybe put a comment above this new method
de4517a
to
ad6479a
Compare
80ad123
to
afcbb93
Compare
instead of using "* radians(0.01)" I'd prefer we create a new method called something like, "radians_from_cd(x)" |
@rmackay9 maybe cd_to_rad() ? |
@@ -203,40 +203,51 @@ class AC_AttitudeControl { | |||
|
|||
// Command an euler roll and pitch angle and an euler yaw rate with angular velocity feedforward and smoothing | |||
virtual void input_euler_angle_roll_pitch_euler_rate_yaw_cd(float euler_roll_angle_cd, float euler_pitch_angle_cd, float euler_yaw_rate_cds); |
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.
The wrapper functions don't need to be virtual.
ArduCopter/mode.cpp
Outdated
@@ -768,7 +768,7 @@ void Mode::land_run_horizontal_control() | |||
// interpolate for 1m above that | |||
const float attitude_limit_cd = linear_interpolate(700, copter.aparm.angle_max, get_alt_above_ground_cm(), | |||
g2.wp_navalt_min*100U, (g2.wp_navalt_min+1)*100U); | |||
const float thrust_vector_max = sinf(radians(attitude_limit_cd * 0.01f)) * GRAVITY_MSS * 100.0f; | |||
const float thrust_vector_max = sinf(attitude_limit_cd * radians(0.01f)) * GRAVITY_MSS * 100.0f; |
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.
I would strongly prefer a cd_to_rad() function or similar
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.
IMHO cdeg_to_rad would be more readable.
afcbb93
to
dbb577d
Compare
dbb577d
to
ad922f7
Compare
This PR adds radian (_rad, _rads) variants of all input_XXX rate and attitude commands in AC_AttitudeControl. These functions mirror the existing centidegree-based (_cd, _cds) methods, enabling direct use of SI units or the addition of degrees.
This does add size:
After AC_AttitudeControl: Add conversions from cd to rad