PX4 Firmware
PX4 Autopilot Software http://px4.io
land_detector::LandDetector Class Referenceabstract

#include <LandDetector.h>

Inheritance diagram for land_detector::LandDetector:
Collaboration diagram for land_detector::LandDetector:

Public Member Functions

 LandDetector ()
 
virtual ~LandDetector ()
 
int print_status () override
 
void start ()
 Get the work queue going. More...
 

Static Public Member Functions

static int custom_command (int argc, char *argv[])
 
static int print_usage (const char *reason=nullptr)
 
static int task_spawn (int argc, char *argv[])
 

Protected Member Functions

virtual void _update_params ()
 Updates parameters. More...
 
virtual void _update_topics ()
 Updates subscribed uORB topics. More...
 
virtual bool _get_landed_state ()=0
 
virtual bool _get_maybe_landed_state ()
 
virtual bool _get_ground_contact_state ()
 
virtual bool _get_freefall_state ()
 
virtual float _get_max_altitude ()
 
virtual bool _get_ground_effect_state ()
 

Protected Attributes

systemlib::Hysteresis _freefall_hysteresis {false}
 
systemlib::Hysteresis _landed_hysteresis {true}
 
systemlib::Hysteresis _maybe_landed_hysteresis {true}
 
systemlib::Hysteresis _ground_contact_hysteresis {true}
 
systemlib::Hysteresis _ground_effect_hysteresis {false}
 
actuator_armed_s _actuator_armed {}
 
vehicle_acceleration_s _vehicle_acceleration {}
 
vehicle_land_detected_s _land_detected
 
vehicle_local_position_s _vehicle_local_position {}
 
uORB::Publication< vehicle_land_detected_s_vehicle_land_detected_pub {ORB_ID(vehicle_land_detected)}
 

Static Protected Attributes

static constexpr uint32_t LAND_DETECTOR_UPDATE_INTERVAL = 20_ms
 Run main land detector loop at this interval. More...
 

Private Member Functions

void Run () override
 
void _update_state ()
 
void _update_total_flight_time ()
 
 DEFINE_PARAMETERS_CUSTOM_PARENT (ModuleParams,(ParamInt< px4::params::LND_FLIGHT_T_HI >) _param_total_flight_time_high,(ParamInt< px4::params::LND_FLIGHT_T_LO >) _param_total_flight_time_low)
 

Private Attributes

bool _previous_armed_state {false}
 stores the previous actuator_armed.armed state More...
 
hrt_abstime _takeoff_time {0}
 
hrt_abstime _total_flight_time {0}
 total vehicle flight time in microseconds More...
 
perf_counter_t _cycle_perf {perf_alloc(PC_ELAPSED, "land_detector_cycle")}
 
uORB::Subscription _actuator_armed_sub {ORB_ID(actuator_armed)}
 
uORB::Subscription _parameter_update_sub {ORB_ID(parameter_update)}
 
uORB::Subscription _vehicle_acceleration_sub {ORB_ID(vehicle_acceleration)}
 
uORB::Subscription _vehicle_local_position_sub {ORB_ID(vehicle_local_position)}
 

Detailed Description

Definition at line 70 of file LandDetector.h.

Constructor & Destructor Documentation

◆ LandDetector()

land_detector::LandDetector::LandDetector ( )

Definition at line 48 of file LandDetector.cpp.

◆ ~LandDetector()

land_detector::LandDetector::~LandDetector ( )
virtual

Definition at line 53 of file LandDetector.cpp.

References _cycle_perf, and perf_free().

Here is the call graph for this function:

Member Function Documentation

◆ _get_freefall_state()

virtual bool land_detector::LandDetector::_get_freefall_state ( )
inlineprotectedvirtual
Returns
true if UAV is in free-fall state.

Reimplemented in land_detector::MulticopterLandDetector.

Definition at line 127 of file LandDetector.h.

Referenced by _update_state().

Here is the caller graph for this function:

◆ _get_ground_contact_state()

virtual bool land_detector::LandDetector::_get_ground_contact_state ( )
inlineprotectedvirtual
Returns
true if UAV is touching ground but not landed

Reimplemented in land_detector::MulticopterLandDetector, and land_detector::RoverLandDetector.

Definition at line 122 of file LandDetector.h.

Referenced by _update_state().

Here is the caller graph for this function:

◆ _get_ground_effect_state()

virtual bool land_detector::LandDetector::_get_ground_effect_state ( )
inlineprotectedvirtual
Returns
true if vehicle could be in ground effect (close to ground)

Reimplemented in land_detector::MulticopterLandDetector.

Definition at line 137 of file LandDetector.h.

Referenced by _update_state().

Here is the caller graph for this function:

◆ _get_landed_state()

virtual bool land_detector::LandDetector::_get_landed_state ( )
protectedpure virtual
Returns
true if UAV is in a landed state.

Implemented in land_detector::MulticopterLandDetector, land_detector::FixedwingLandDetector, land_detector::VtolLandDetector, and land_detector::RoverLandDetector.

Referenced by _update_state().

Here is the caller graph for this function:

◆ _get_max_altitude()

virtual float land_detector::LandDetector::_get_max_altitude ( )
inlineprotectedvirtual
Returns
maximum altitude that can be reached

Reimplemented in land_detector::MulticopterLandDetector.

Definition at line 132 of file LandDetector.h.

Referenced by Run().

Here is the caller graph for this function:

◆ _get_maybe_landed_state()

virtual bool land_detector::LandDetector::_get_maybe_landed_state ( )
inlineprotectedvirtual
Returns
true if UAV is in almost landed state

Reimplemented in land_detector::MulticopterLandDetector, and land_detector::VtolLandDetector.

Definition at line 117 of file LandDetector.h.

Referenced by _update_state().

Here is the caller graph for this function:

◆ _update_params()

void land_detector::LandDetector::_update_params ( )
protectedvirtual

Updates parameters.

Reimplemented in land_detector::MulticopterLandDetector.

Definition at line 137 of file LandDetector.cpp.

References _parameter_update_sub, _update_total_flight_time(), and uORB::Subscription::copy().

Referenced by land_detector::MulticopterLandDetector::_update_params(), Run(), and start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _update_state()

void land_detector::LandDetector::_update_state ( )
private

Definition at line 146 of file LandDetector.cpp.

References _freefall_hysteresis, _get_freefall_state(), _get_ground_contact_state(), _get_ground_effect_state(), _get_landed_state(), _get_maybe_landed_state(), _ground_contact_hysteresis, _ground_effect_hysteresis, _landed_hysteresis, _maybe_landed_hysteresis, hrt_absolute_time(), hrt_abstime, and systemlib::Hysteresis::set_state_and_update().

Referenced by Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _update_topics()

void land_detector::LandDetector::_update_topics ( )
protectedvirtual

Updates subscribed uORB topics.

Reimplemented in land_detector::MulticopterLandDetector, land_detector::FixedwingLandDetector, and land_detector::VtolLandDetector.

Definition at line 158 of file LandDetector.cpp.

References _actuator_armed, _actuator_armed_sub, _vehicle_acceleration, _vehicle_acceleration_sub, _vehicle_local_position, _vehicle_local_position_sub, and uORB::Subscription::update().

Referenced by land_detector::FixedwingLandDetector::_update_topics(), land_detector::MulticopterLandDetector::_update_topics(), and Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _update_total_flight_time()

void land_detector::LandDetector::_update_total_flight_time ( )
private

Definition at line 165 of file LandDetector.cpp.

References _total_flight_time.

Referenced by _update_params().

Here is the caller graph for this function:

◆ custom_command()

static int land_detector::LandDetector::custom_command ( int  argc,
char *  argv[] 
)
inlinestatic
See also
ModuleBase

Definition at line 79 of file LandDetector.h.

References print_status(), print_usage(), and start().

Here is the call graph for this function:

◆ DEFINE_PARAMETERS_CUSTOM_PARENT()

land_detector::LandDetector::DEFINE_PARAMETERS_CUSTOM_PARENT ( ModuleParams  ,
(ParamInt< px4::params::LND_FLIGHT_T_HI >)  _param_total_flight_time_high,
(ParamInt< px4::params::LND_FLIGHT_T_LO >)  _param_total_flight_time_low 
)
private

◆ print_status()

int land_detector::LandDetector::print_status ( )
override
See also
ModuleBase::print_status()

Definition at line 104 of file land_detector_main.cpp.

◆ print_usage()

int land_detector::LandDetector::print_usage ( const char *  reason = nullptr)
static
See also
ModuleBase

Definition at line 109 of file land_detector_main.cpp.

Referenced by task_spawn().

Here is the caller graph for this function:

◆ Run()

◆ start()

void land_detector::LandDetector::start ( )

Get the work queue going.

Definition at line 58 of file LandDetector.cpp.

References _update_params(), and LAND_DETECTOR_UPDATE_INTERVAL.

Referenced by task_spawn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_spawn()

int land_detector::LandDetector::task_spawn ( int  argc,
char *  argv[] 
)
static

Definition at line 61 of file land_detector_main.cpp.

References land_detector::_currentMode, print_usage(), and start().

Here is the call graph for this function:

Member Data Documentation

◆ _actuator_armed

◆ _actuator_armed_sub

uORB::Subscription land_detector::LandDetector::_actuator_armed_sub {ORB_ID(actuator_armed)}
private

Definition at line 179 of file LandDetector.h.

Referenced by _update_topics(), and Run().

◆ _cycle_perf

perf_counter_t land_detector::LandDetector::_cycle_perf {perf_alloc(PC_ELAPSED, "land_detector_cycle")}
private

Definition at line 177 of file LandDetector.h.

Referenced by Run(), and ~LandDetector().

◆ _freefall_hysteresis

systemlib::Hysteresis land_detector::LandDetector::_freefall_hysteresis {false}
protected

◆ _ground_contact_hysteresis

systemlib::Hysteresis land_detector::LandDetector::_ground_contact_hysteresis {true}
protected

◆ _ground_effect_hysteresis

systemlib::Hysteresis land_detector::LandDetector::_ground_effect_hysteresis {false}
protected

Definition at line 146 of file LandDetector.h.

Referenced by _update_state(), and Run().

◆ _land_detected

vehicle_land_detected_s land_detector::LandDetector::_land_detected
protected
Initial value:
= {
.timestamp = 0,
.alt_max = -1.0f,
.freefall = false,
.ground_contact = true,
.maybe_landed = true,
.landed = true,
}

Definition at line 151 of file LandDetector.h.

Referenced by Run().

◆ _landed_hysteresis

systemlib::Hysteresis land_detector::LandDetector::_landed_hysteresis {true}
protected

◆ _maybe_landed_hysteresis

systemlib::Hysteresis land_detector::LandDetector::_maybe_landed_hysteresis {true}
protected

◆ _parameter_update_sub

uORB::Subscription land_detector::LandDetector::_parameter_update_sub {ORB_ID(parameter_update)}
private

Definition at line 180 of file LandDetector.h.

Referenced by _update_params(), and Run().

◆ _previous_armed_state

bool land_detector::LandDetector::_previous_armed_state {false}
private

stores the previous actuator_armed.armed state

Definition at line 172 of file LandDetector.h.

Referenced by Run().

◆ _takeoff_time

hrt_abstime land_detector::LandDetector::_takeoff_time {0}
private

Definition at line 174 of file LandDetector.h.

Referenced by Run().

◆ _total_flight_time

hrt_abstime land_detector::LandDetector::_total_flight_time {0}
private

total vehicle flight time in microseconds

Definition at line 175 of file LandDetector.h.

Referenced by _update_total_flight_time(), and Run().

◆ _vehicle_acceleration

vehicle_acceleration_s land_detector::LandDetector::_vehicle_acceleration {}
protected

◆ _vehicle_acceleration_sub

uORB::Subscription land_detector::LandDetector::_vehicle_acceleration_sub {ORB_ID(vehicle_acceleration)}
private

Definition at line 181 of file LandDetector.h.

Referenced by _update_topics().

◆ _vehicle_land_detected_pub

uORB::Publication<vehicle_land_detected_s> land_detector::LandDetector::_vehicle_land_detected_pub {ORB_ID(vehicle_land_detected)}
protected

Definition at line 162 of file LandDetector.h.

Referenced by Run().

◆ _vehicle_local_position

◆ _vehicle_local_position_sub

uORB::Subscription land_detector::LandDetector::_vehicle_local_position_sub {ORB_ID(vehicle_local_position)}
private

Definition at line 182 of file LandDetector.h.

Referenced by _update_topics().

◆ LAND_DETECTOR_UPDATE_INTERVAL

constexpr uint32_t land_detector::LandDetector::LAND_DETECTOR_UPDATE_INTERVAL = 20_ms
staticprotected

Run main land detector loop at this interval.

Definition at line 140 of file LandDetector.h.

Referenced by start().


The documentation for this class was generated from the following files: