mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
add new parameters for roll and pitch angular rate limits
This commit is contained in:
committed by
Lorenz Meier
parent
a07712bb1e
commit
7f418445f2
@@ -202,7 +202,7 @@ private:
|
|||||||
float roll_rate_max;
|
float roll_rate_max;
|
||||||
float pitch_rate_max;
|
float pitch_rate_max;
|
||||||
float yaw_rate_max;
|
float yaw_rate_max;
|
||||||
math::Vector<3> mc_rate_max; /**< attitude rate limits in stabilized modes */
|
math::Vector<3> mc_rate_max; /**< attitude rate limits in all modes */
|
||||||
|
|
||||||
float man_roll_max;
|
float man_roll_max;
|
||||||
float man_pitch_max;
|
float man_pitch_max;
|
||||||
@@ -656,14 +656,11 @@ MulticopterAttitudeControl::control_attitude(float dt)
|
|||||||
/* calculate angular rates setpoint */
|
/* calculate angular rates setpoint */
|
||||||
_rates_sp = _params.att_p.emult(e_R);
|
_rates_sp = _params.att_p.emult(e_R);
|
||||||
|
|
||||||
/* limit roll and pitch rates */
|
/* limit rates */
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
_rates_sp(i) = math::constrain(_rates_sp(i), -_params.acro_rate_max(i), _params.acro_rate_max(i));
|
_rates_sp(i) = math::constrain(_rates_sp(i), -_params.mc_rate_max(i), _params.mc_rate_max(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* limit yaw rate */
|
|
||||||
_rates_sp(2) = math::constrain(_rates_sp(2), -_params.yaw_rate_max, _params.yaw_rate_max);
|
|
||||||
|
|
||||||
/* feed forward yaw setpoint rate */
|
/* feed forward yaw setpoint rate */
|
||||||
_rates_sp(2) += _v_att_sp.yaw_sp_move_rate * yaw_w * _params.yaw_ff;
|
_rates_sp(2) += _v_att_sp.yaw_sp_move_rate * yaw_w * _params.yaw_ff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ PARAM_DEFINE_FLOAT(MC_YAW_FF, 0.5f);
|
|||||||
* @max 360.0
|
* @max 360.0
|
||||||
* @group Multicopter Attitude Control
|
* @group Multicopter Attitude Control
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_ROLLRATE_MAX, 360.0f);
|
PARAM_DEFINE_FLOAT(MC_ROLLRATE_MAX, 120.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max pitch rate
|
* Max pitch rate
|
||||||
@@ -227,7 +227,7 @@ PARAM_DEFINE_FLOAT(MC_ROLLRATE_MAX, 360.0f);
|
|||||||
* @max 360.0
|
* @max 360.0
|
||||||
* @group Multicopter Attitude Control
|
* @group Multicopter Attitude Control
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_PITCHRATE_MAX, 360.0f);
|
PARAM_DEFINE_FLOAT(MC_PITCHRATE_MAX, 120.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max yaw rate
|
* Max yaw rate
|
||||||
|
|||||||
Reference in New Issue
Block a user