mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 08:03:36 +08:00
LandDetector: switch land flags to properies instead of one state
This commit is contained in:
committed by
Daniel Agar
parent
1e1549a169
commit
679e4fedf5
@@ -69,13 +69,6 @@ namespace land_detector
|
||||
class LandDetector : public ModuleBase<LandDetector>, ModuleParams, px4::ScheduledWorkItem
|
||||
{
|
||||
public:
|
||||
enum class LandDetectionState {
|
||||
FLYING = 0,
|
||||
LANDED = 1,
|
||||
FREEFALL = 2,
|
||||
GROUND_CONTACT = 3,
|
||||
MAYBE_LANDED = 4
|
||||
};
|
||||
|
||||
LandDetector();
|
||||
virtual ~LandDetector();
|
||||
@@ -93,11 +86,6 @@ public:
|
||||
/** @see ModuleBase::print_status() */
|
||||
int print_status() override;
|
||||
|
||||
/**
|
||||
* @return current state.
|
||||
*/
|
||||
LandDetectionState get_state() const { return _state; }
|
||||
|
||||
/**
|
||||
* Get the work queue going.
|
||||
*/
|
||||
@@ -151,8 +139,6 @@ protected:
|
||||
/** Run main land detector loop at this interval. */
|
||||
static constexpr uint32_t LAND_DETECTOR_UPDATE_INTERVAL = 20_ms;
|
||||
|
||||
LandDetectionState _state{LandDetectionState::LANDED};
|
||||
|
||||
systemlib::Hysteresis _freefall_hysteresis{false};
|
||||
systemlib::Hysteresis _landed_hysteresis{true};
|
||||
systemlib::Hysteresis _maybe_landed_hysteresis{true};
|
||||
@@ -161,7 +147,14 @@ protected:
|
||||
|
||||
actuator_armed_s _actuator_armed{};
|
||||
vehicle_acceleration_s _vehicle_acceleration{};
|
||||
vehicle_land_detected_s _land_detected{};
|
||||
vehicle_land_detected_s _land_detected = {
|
||||
.timestamp = 0,
|
||||
.alt_max = -1.0f,
|
||||
.freefall = false,
|
||||
.ground_contact = true,
|
||||
.maybe_landed = true,
|
||||
.landed = true,
|
||||
};
|
||||
vehicle_local_position_s _vehicle_local_position{};
|
||||
|
||||
orb_advert_t _land_detected_pub{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user