mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 05:33:33 +08:00
Changes to the PID controller. Adds "limit" to the parameter set. Implements an output limit where the output magnitude is limited by the parameter value "limit". Also changes the integrator saturation such that the integrator is not updated (added to) if either updating it will cause the integrator values magnitude to exceed "intmax" or if the output magnitude would exceed "limit" with an updated integrator value.
Arbitrary large limit values were hard coded into multirotor_attitude_control.c. These should be changed to parametric values or something sensible. This commit will temporarily break fixedwing_control.c. A following commit will repair it along with significant changes to the inner loop control. This commit has been tested to compile with fixedwing_control.c temporarily removed. No other testing has been completed.
This commit is contained in:
@@ -212,13 +212,13 @@ void multirotor_control_attitude(const struct vehicle_attitude_setpoint_s *att_s
|
||||
parameters_update(&h, &p);
|
||||
|
||||
// pid_init(&yaw_pos_controller, p.yaw_p, p.yaw_i, p.yaw_d, p.yaw_awu,
|
||||
// PID_MODE_DERIVATIV_SET, 154);
|
||||
// 90.0f, PID_MODE_DERIVATIV_SET, 154); // Arbitrarily large limit added
|
||||
pid_init(&yaw_speed_controller, p.yawrate_p, p.yawrate_i, p.yawrate_d, p.yawrate_awu,
|
||||
PID_MODE_DERIVATIV_SET);
|
||||
90.0f, PID_MODE_DERIVATIV_SET); // Arbitrarily large limit added
|
||||
pid_init(&pitch_controller, p.att_p, p.att_i, p.att_d, p.att_awu,
|
||||
PID_MODE_DERIVATIV_SET);
|
||||
90.0f, PID_MODE_DERIVATIV_SET); // Arbitrarily large limit added
|
||||
pid_init(&roll_controller, p.att_p, p.att_i, p.att_d, p.att_awu,
|
||||
PID_MODE_DERIVATIV_SET);
|
||||
90.0f, PID_MODE_DERIVATIV_SET); // Arbitrarily large limit added
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
@@ -228,10 +228,10 @@ void multirotor_control_attitude(const struct vehicle_attitude_setpoint_s *att_s
|
||||
/* update parameters from storage */
|
||||
parameters_update(&h, &p);
|
||||
/* apply parameters */
|
||||
// pid_set_parameters(&yaw_pos_controller, p.yaw_p, p.yaw_i, p.yaw_d, p.yaw_awu);
|
||||
pid_set_parameters(&yaw_speed_controller, p.yawrate_p, p.yawrate_i, p.yawrate_d, p.yawrate_awu);
|
||||
pid_set_parameters(&pitch_controller, p.att_p, p.att_i, p.att_d, p.att_awu);
|
||||
pid_set_parameters(&roll_controller, p.att_p, p.att_i, p.att_d, p.att_awu);
|
||||
// pid_set_parameters(&yaw_pos_controller, p.yaw_p, p.yaw_i, p.yaw_d, p.yaw_awu, 90.0f);
|
||||
pid_set_parameters(&yaw_speed_controller, p.yawrate_p, p.yawrate_i, p.yawrate_d, p.yawrate_awu, 90.0f);
|
||||
pid_set_parameters(&pitch_controller, p.att_p, p.att_i, p.att_d, p.att_awu, 90.0f);
|
||||
pid_set_parameters(&roll_controller, p.att_p, p.att_i, p.att_d, p.att_awu, 90.0f);
|
||||
}
|
||||
|
||||
/* calculate current control outputs */
|
||||
|
||||
Reference in New Issue
Block a user