From bd7284634d5e224b885ca61f7b636d8c5bd65a05 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 9 Aug 2017 11:43:36 -0400 Subject: [PATCH] land_detector add missing header and init all vtol fields (#7754) --- src/modules/land_detector/VtolLandDetector.cpp | 10 +--------- src/modules/land_detector/VtolLandDetector.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/modules/land_detector/VtolLandDetector.cpp b/src/modules/land_detector/VtolLandDetector.cpp index 1984a96c1b..5ef6db0db4 100644 --- a/src/modules/land_detector/VtolLandDetector.cpp +++ b/src/modules/land_detector/VtolLandDetector.cpp @@ -46,14 +46,7 @@ namespace land_detector { -VtolLandDetector::VtolLandDetector() : - _paramHandle(), - _params(), - _airspeedSub(-1), - _vehicle_status_sub(-1), - _airspeed{}, - _was_in_air(false), - _airspeed_filtered(0) +VtolLandDetector::VtolLandDetector() { _paramHandle.maxAirSpeed = param_find("LNDFW_AIRSPD_MAX"); } @@ -76,7 +69,6 @@ void VtolLandDetector::_update_topics() bool VtolLandDetector::_get_maybe_landed_state() { - // Only trigger in RW mode if (!_vehicle_status.is_rotary_wing) { return false; diff --git a/src/modules/land_detector/VtolLandDetector.h b/src/modules/land_detector/VtolLandDetector.h index 25695553b9..b3aa67678f 100644 --- a/src/modules/land_detector/VtolLandDetector.h +++ b/src/modules/land_detector/VtolLandDetector.h @@ -42,6 +42,7 @@ #pragma once #include +#include #include "MulticopterLandDetector.h" @@ -60,24 +61,23 @@ protected: bool _get_landed_state() override; bool _get_maybe_landed_state() override; - private: struct { param_t maxAirSpeed; - } _paramHandle; + } _paramHandle{}; struct { float maxAirSpeed; - } _params; + } _params{}; - int _airspeedSub; - int _vehicle_status_sub; + int _airspeedSub{-1}; + int _vehicle_status_sub{-1}; - struct airspeed_s _airspeed; - struct vehicle_status_s _vehicle_status; + airspeed_s _airspeed{}; + vehicle_status_s _vehicle_status{}; - bool _was_in_air; /**< indicates whether the vehicle was in the air in the previous iteration */ - float _airspeed_filtered; /**< low pass filtered airspeed */ + bool _was_in_air{false}; /**< indicates whether the vehicle was in the air in the previous iteration */ + float _airspeed_filtered{0.0f}; /**< low pass filtered airspeed */ };