From ff415a4f1d30030982976d1435819d82bb47d996 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Fri, 21 Oct 2016 17:21:49 +0200 Subject: [PATCH] mc_pos_control: correctly initialize landed state Since orb_copy is guarded with a orb_check, we ended up not having the corrent landed state in the beginning which could lead to some unexpected behaviour on takeoff. --- src/modules/mc_pos_control/mc_pos_control_main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp index c6c913b1f4..6acffc0dfc 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -1244,6 +1244,9 @@ MulticopterPositionControl::task_main() /* get an initial update for all sensor and status data */ poll_subscriptions(); + /* We really need to know from the beginning if we're landed or in-air. */ + orb_copy(ORB_ID(vehicle_land_detected), _vehicle_land_detected_sub, &_vehicle_land_detected); + bool reset_int_z = true; bool reset_int_z_manual = false; bool reset_int_xy = true;