mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 19:08:29 +08:00
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:
@@ -1285,6 +1285,15 @@ FixedwingPositionControl::control_position(const math::Vector<2> ¤t_positi
|
|||||||
|
|
||||||
/* filter speed and altitude for controller */
|
/* filter speed and altitude for controller */
|
||||||
math::Vector<3> accel_body(_sensor_combined.accelerometer_m_s2);
|
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;
|
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 */
|
/* tell TECS to update its state, but let it know when it cannot actually control the plane */
|
||||||
|
|||||||
Reference in New Issue
Block a user