fw_pos_control_l1: for tailsitters we need to rotate the body acceleration

vector as it has it's reference in the mc frame

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman 2016-08-19 17:30:20 +02:00 committed by Andreas Antener
parent e1e410783a
commit ab4731a99f
1 changed files with 9 additions and 0 deletions

View File

@ -1285,6 +1285,15 @@ FixedwingPositionControl::control_position(const math::Vector<2> &current_positi
/* filter speed and altitude for controller */
math::Vector<3> accel_body(_sensor_combined.accelerometer_m_s2);
// tailsitters use the multicopter frame as reference, in fixed wing
// we need to use the fixed wing frame
if (_parameters.vtol_type == vtol_type::TAILSITTER && _vehicle_status.is_vtol) {
float tmp = accel_body(0);
accel_body(0) = -accel_body(2);
accel_body(2) = tmp;
}
math::Vector<3> accel_earth = _R_nb * accel_body;
/* tell TECS to update its state, but let it know when it cannot actually control the plane */