forked from Archive/PX4-Autopilot
fixed rates feedforward: plant for feedforward is given by derivative operator
This commit is contained in:
parent
ccac324f5b
commit
5b6f1b5ca5
|
@ -158,6 +158,7 @@ private:
|
|||
perf_counter_t _controller_latency_perf;
|
||||
|
||||
math::Vector<3> _rates_prev; /**< angular rates on previous step */
|
||||
math::Vector<3> _rates_sp_prev; /**< previous rates setpoint */
|
||||
math::Vector<3> _rates_sp; /**< angular rates setpoint */
|
||||
math::Vector<3> _rates_int; /**< angular rates integral error */
|
||||
float _thrust_sp; /**< thrust setpoint */
|
||||
|
@ -353,6 +354,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
|
|||
|
||||
_rates_prev.zero();
|
||||
_rates_sp.zero();
|
||||
_rates_sp_prev.zero();
|
||||
_rates_int.zero();
|
||||
_thrust_sp = 0.0f;
|
||||
_att_control.zero();
|
||||
|
@ -712,7 +714,8 @@ MulticopterAttitudeControl::control_attitude_rates(float dt)
|
|||
|
||||
/* angular rates error */
|
||||
math::Vector<3> rates_err = _rates_sp - rates;
|
||||
_att_control = _params.rate_p.emult(rates_err) + _params.rate_d.emult(_rates_prev - rates) / dt + _rates_int + _params.rate_ff.emult(_rates_sp);
|
||||
_att_control = _params.rate_p.emult(rates_err) + _params.rate_d.emult(_rates_prev - rates) / dt + _rates_int + _params.rate_ff.emult(_rates_sp - _rates_sp_prev) / dt;
|
||||
_rates_sp_prev = _rates_sp;
|
||||
_rates_prev = rates;
|
||||
|
||||
/* update integral only if not saturated on low limit and if motor commands are not saturated */
|
||||
|
|
Loading…
Reference in New Issue