diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp index f8f1da6a37..abbff94754 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp @@ -317,7 +317,11 @@ FixedwingAttitudeControl::vehicle_land_detected_poll() orb_check(_vehicle_land_detected_sub, &vehicle_land_detected_updated); if (vehicle_land_detected_updated) { - orb_copy(ORB_ID(vehicle_land_detected), _vehicle_land_detected_sub, &_vehicle_land_detected); + vehicle_land_detected_s vehicle_land_detected {}; + + if (orb_copy(ORB_ID(vehicle_land_detected), _vehicle_land_detected_sub, &vehicle_land_detected) == PX4_OK) { + _landed = vehicle_land_detected.landed; + } } } @@ -619,7 +623,7 @@ void FixedwingAttitudeControl::run() /* Reset integrators if the aircraft is on ground * or a multicopter (but not transitioning VTOL) */ - if (_vehicle_land_detected.landed + if (_landed || (_vehicle_status.is_rotary_wing && !_vehicle_status.in_transition_mode)) { _roll_ctrl.reset_integrator(); diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.hpp b/src/modules/fw_att_control/FixedwingAttitudeControl.hpp index 6f50d9d83e..4966ec60f2 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.hpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.hpp @@ -122,7 +122,6 @@ private: vehicle_attitude_setpoint_s _att_sp {}; /**< vehicle attitude setpoint */ vehicle_control_mode_s _vcontrol_mode {}; /**< vehicle control mode */ vehicle_global_position_s _global_pos {}; /**< global position */ - vehicle_land_detected_s _vehicle_land_detected {}; /**< vehicle land detected */ vehicle_rates_setpoint_s _rates_sp {}; /* attitude rates setpoint */ vehicle_status_s _vehicle_status {}; /**< vehicle status */ @@ -135,6 +134,8 @@ private: float _flaps_applied{0.0f}; float _flaperons_applied{0.0f}; + bool _landed{true}; + struct { float p_tc; float p_p;