Skip to content
Snippets Groups Projects
Commit 0f1c9504 authored by Roman's avatar Roman Committed by Lorenz Meier
Browse files

FixedWingPositionControl: rotate attitude consistenly for tailsitters


Signed-off-by: default avatarRoman <bapstroman@gmail.com>
parent e46e6f99
No related branches found
No related tags found
No related merge requests found
......@@ -412,6 +412,13 @@ FixedwingPositionControl::vehicle_attitude_poll()
/* set rotation matrix and euler angles */
_R_nb = Quatf(_att.q);
// if the vehicle is a tailsitter we have to rotate the attitude by the pitch offset
// between multirotor and fixed wing flight
if (_parameters.vtol_type == vtol_type::TAILSITTER && _vehicle_status.is_vtol) {
Dcmf R_offset = Eulerf(0, M_PI_2_F, 0);
_R_nb = _R_nb * R_offset;
}
Eulerf euler_angles(_R_nb);
_roll = euler_angles(0);
_pitch = euler_angles(1);
......@@ -1878,14 +1885,6 @@ FixedwingPositionControl::tecs_update_pitch_throttle(float alt_sp, float airspee
/* Using tecs library */
float pitch_for_tecs = _pitch - _parameters.pitchsp_offset_rad;
// if the vehicle is a tailsitter we have to rotate the attitude by the pitch offset
// between multirotor and fixed wing flight
if (_parameters.vtol_type == vtol_type::TAILSITTER && _vehicle_status.is_vtol) {
Dcmf R_offset = Eulerf(0, M_PI_2_F, 0);
Eulerf euler = Eulerf(_R_nb * R_offset);
pitch_for_tecs = euler(1);
}
/* filter speed and altitude for controller */
Vector3f accel_body(_sub_sensors.get().accel_x, _sub_sensors.get().accel_y, _sub_sensors.get().accel_z);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment