1
$\begingroup$

I am trying to translate controller diagram of fixed wing px4 attitude control into mathematical form. While going through the controller diagram Fixed-Wing Attitude Controller looking into PX4 github code for pitch control Ref I found the following output,

 _last_output = _bodyrate_setpoint * _k_ff * ctl_data.scaler +
                _rate_error * _k_p * ctl_data.scaler * ctl_data.scaler
                + _integrator;  //scaler is proportional to 1/airspeed

For understanding, I am keeping scaler as one and lateral states as zero. so last output which is elevator deflection looks following.

_last_output = (ctl_data.pitch_setpoint - ctl_data.pitch )*_k_ff  +((ctl_data.pitch_setpoint - ctl_data.pitch) - ctl_data.body_y_rate) * _k_p  + integral((ctl_data.pitch_setpoint - ctl_data.pitch)*dt);

My doubt is if we want to pitch up, (pitch_setpoint-pitch) will be positive, and with all gain values being positive in PX4 controller, RHS is positive, but conventionally we give negative elevator deflection for pitch up. How is this taken care in the PX4 firmware? Can anyone explain or give a clearer picture of how this is possible? I may not be able to format the question very well but I have drawn a similar scenario in the picture attached. Simple pitch feedback loop

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.