mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 14:33:34 +08:00
Remove euler angles from attitude setpoint (#23482)
* Remove euler angles from attitude setpoint message * Remove usage of euler angles in attitude setpoint messages This commit removes the usage of euler angles in the vehicle_attitude_setpoint messages * Fix standard vtol
This commit is contained in:
@@ -203,6 +203,11 @@ void Tiltrotor::update_transition_state()
|
||||
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
|
||||
const Eulerf attitude_setpoint_euler(Quatf(_v_att_sp->q_d));
|
||||
float roll_body = attitude_setpoint_euler.phi();
|
||||
float pitch_body = attitude_setpoint_euler.theta();
|
||||
float yaw_body = attitude_setpoint_euler.psi();
|
||||
|
||||
// we get attitude setpoint from a multirotor flighttask if altitude is controlled.
|
||||
// in any other case the fixed wing attitude controller publishes attitude setpoint from manual stick input.
|
||||
if (_v_control_mode->flag_control_climb_rate_enabled) {
|
||||
@@ -212,7 +217,7 @@ void Tiltrotor::update_transition_state()
|
||||
}
|
||||
|
||||
memcpy(_v_att_sp, _mc_virtual_att_sp, sizeof(vehicle_attitude_setpoint_s));
|
||||
_v_att_sp->roll_body = _fw_virtual_att_sp->roll_body;
|
||||
roll_body = Eulerf(Quatf(_fw_virtual_att_sp->q_d)).phi();
|
||||
_thrust_transition = -_mc_virtual_att_sp->thrust_body[2];
|
||||
|
||||
} else {
|
||||
@@ -290,7 +295,7 @@ void Tiltrotor::update_transition_state()
|
||||
|
||||
// control backtransition deceleration using pitch.
|
||||
if (_v_control_mode->flag_control_climb_rate_enabled) {
|
||||
_v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp();
|
||||
pitch_body = update_and_get_backtransition_pitch_sp();
|
||||
}
|
||||
|
||||
if (_time_since_trans_start < BACKTRANS_THROTTLE_DOWNRAMP_DUR_S) {
|
||||
@@ -321,7 +326,7 @@ void Tiltrotor::update_transition_state()
|
||||
|
||||
_v_att_sp->thrust_body[2] = -_thrust_transition;
|
||||
|
||||
const Quatf q_sp(Eulerf(_v_att_sp->roll_body, _v_att_sp->pitch_body, _v_att_sp->yaw_body));
|
||||
const Quatf q_sp(Eulerf(roll_body, pitch_body, yaw_body));
|
||||
q_sp.copyTo(_v_att_sp->q_d);
|
||||
|
||||
_mc_roll_weight = math::constrain(_mc_roll_weight, 0.0f, 1.0f);
|
||||
|
||||
Reference in New Issue
Block a user