mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:28:53 +08:00
land detector FW uniform initialization
This commit is contained in:
@@ -41,28 +41,15 @@
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#include "FixedwingLandDetector.h"
|
||||
|
||||
|
||||
namespace land_detector
|
||||
{
|
||||
|
||||
FixedwingLandDetector::FixedwingLandDetector() :
|
||||
_paramHandle(),
|
||||
_params(),
|
||||
_controlStateSub(-1),
|
||||
_armingSub(-1),
|
||||
_airspeedSub(-1),
|
||||
_controlState{},
|
||||
_arming{},
|
||||
_airspeed{},
|
||||
_velocity_xy_filtered(0.0f),
|
||||
_velocity_z_filtered(0.0f),
|
||||
_airspeed_filtered(0.0f),
|
||||
_accel_horz_lp(0.0f)
|
||||
FixedwingLandDetector::FixedwingLandDetector()
|
||||
{
|
||||
_paramHandle.maxVelocity = param_find("LNDFW_VEL_XY_MAX");
|
||||
_paramHandle.maxClimbRate = param_find("LNDFW_VEL_Z_MAX");
|
||||
|
||||
@@ -57,21 +57,15 @@ public:
|
||||
FixedwingLandDetector();
|
||||
|
||||
protected:
|
||||
virtual void _initialize_topics() override;
|
||||
void _initialize_topics() override;
|
||||
void _update_params() override;
|
||||
void _update_topics() override;
|
||||
bool _get_landed_state() override;
|
||||
bool _get_maybe_landed_state() override;
|
||||
bool _get_ground_contact_state() override;
|
||||
bool _get_freefall_state() override;
|
||||
float _get_max_altitude() override;
|
||||
|
||||
virtual void _update_params() override;
|
||||
|
||||
virtual void _update_topics() override;
|
||||
|
||||
virtual bool _get_landed_state() override;
|
||||
|
||||
virtual bool _get_maybe_landed_state() override;
|
||||
|
||||
virtual bool _get_ground_contact_state() override;
|
||||
|
||||
virtual bool _get_freefall_state() override;
|
||||
|
||||
virtual float _get_max_altitude() override;
|
||||
private:
|
||||
|
||||
/** Time in us that landing conditions have to hold before triggering a land. */
|
||||
@@ -82,27 +76,27 @@ private:
|
||||
param_t maxClimbRate;
|
||||
param_t maxAirSpeed;
|
||||
param_t maxIntVelocity;
|
||||
} _paramHandle;
|
||||
} _paramHandle{};
|
||||
|
||||
struct {
|
||||
float maxVelocity;
|
||||
float maxClimbRate;
|
||||
float maxAirSpeed;
|
||||
float maxIntVelocity;
|
||||
} _params;
|
||||
} _params{};
|
||||
|
||||
int _controlStateSub;
|
||||
int _armingSub;
|
||||
int _airspeedSub;
|
||||
int _controlStateSub{-1};
|
||||
int _armingSub{-1};
|
||||
int _airspeedSub{-1};
|
||||
|
||||
struct control_state_s _controlState;
|
||||
struct actuator_armed_s _arming;
|
||||
struct airspeed_s _airspeed;
|
||||
control_state_s _controlState{};
|
||||
actuator_armed_s _arming{};
|
||||
airspeed_s _airspeed{};
|
||||
|
||||
float _velocity_xy_filtered;
|
||||
float _velocity_z_filtered;
|
||||
float _airspeed_filtered;
|
||||
float _accel_horz_lp;
|
||||
float _velocity_xy_filtered{0.0f};
|
||||
float _velocity_z_filtered{0.0f};
|
||||
float _airspeed_filtered{0.0f};
|
||||
float _accel_horz_lp{0.0f};
|
||||
};
|
||||
|
||||
} // namespace land_detector
|
||||
|
||||
Reference in New Issue
Block a user