land_detector add missing header and init all vtol fields (#7754)

This commit is contained in:
Daniel Agar 2017-08-09 11:43:36 -04:00 committed by GitHub
parent 3ccf3bf2a8
commit bd7284634d
2 changed files with 10 additions and 18 deletions

View File

@ -46,14 +46,7 @@
namespace land_detector namespace land_detector
{ {
VtolLandDetector::VtolLandDetector() : VtolLandDetector::VtolLandDetector()
_paramHandle(),
_params(),
_airspeedSub(-1),
_vehicle_status_sub(-1),
_airspeed{},
_was_in_air(false),
_airspeed_filtered(0)
{ {
_paramHandle.maxAirSpeed = param_find("LNDFW_AIRSPD_MAX"); _paramHandle.maxAirSpeed = param_find("LNDFW_AIRSPD_MAX");
} }
@ -76,7 +69,6 @@ void VtolLandDetector::_update_topics()
bool VtolLandDetector::_get_maybe_landed_state() bool VtolLandDetector::_get_maybe_landed_state()
{ {
// Only trigger in RW mode // Only trigger in RW mode
if (!_vehicle_status.is_rotary_wing) { if (!_vehicle_status.is_rotary_wing) {
return false; return false;

View File

@ -42,6 +42,7 @@
#pragma once #pragma once
#include <uORB/topics/airspeed.h> #include <uORB/topics/airspeed.h>
#include <uORB/topics/vehicle_status.h>
#include "MulticopterLandDetector.h" #include "MulticopterLandDetector.h"
@ -60,24 +61,23 @@ protected:
bool _get_landed_state() override; bool _get_landed_state() override;
bool _get_maybe_landed_state() override; bool _get_maybe_landed_state() override;
private: private:
struct { struct {
param_t maxAirSpeed; param_t maxAirSpeed;
} _paramHandle; } _paramHandle{};
struct { struct {
float maxAirSpeed; float maxAirSpeed;
} _params; } _params{};
int _airspeedSub; int _airspeedSub{-1};
int _vehicle_status_sub; int _vehicle_status_sub{-1};
struct airspeed_s _airspeed; airspeed_s _airspeed{};
struct vehicle_status_s _vehicle_status; vehicle_status_s _vehicle_status{};
bool _was_in_air; /**< indicates whether the vehicle was in the air in the previous iteration */ bool _was_in_air{false}; /**< indicates whether the vehicle was in the air in the previous iteration */
float _airspeed_filtered; /**< low pass filtered airspeed */ float _airspeed_filtered{0.0f}; /**< low pass filtered airspeed */
}; };