PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <LandDetector.h>
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)} |
Definition at line 70 of file LandDetector.h.
land_detector::LandDetector::LandDetector | ( | ) |
Definition at line 48 of file LandDetector.cpp.
|
virtual |
Definition at line 53 of file LandDetector.cpp.
References _cycle_perf, and perf_free().
|
inlineprotectedvirtual |
Reimplemented in land_detector::MulticopterLandDetector.
Definition at line 127 of file LandDetector.h.
Referenced by _update_state().
|
inlineprotectedvirtual |
Reimplemented in land_detector::MulticopterLandDetector, and land_detector::RoverLandDetector.
Definition at line 122 of file LandDetector.h.
Referenced by _update_state().
|
inlineprotectedvirtual |
Reimplemented in land_detector::MulticopterLandDetector.
Definition at line 137 of file LandDetector.h.
Referenced by _update_state().
|
protectedpure virtual |
Implemented in land_detector::MulticopterLandDetector, land_detector::FixedwingLandDetector, land_detector::VtolLandDetector, and land_detector::RoverLandDetector.
Referenced by _update_state().
|
inlineprotectedvirtual |
Reimplemented in land_detector::MulticopterLandDetector.
Definition at line 132 of file LandDetector.h.
Referenced by Run().
|
inlineprotectedvirtual |
Reimplemented in land_detector::MulticopterLandDetector, and land_detector::VtolLandDetector.
Definition at line 117 of file LandDetector.h.
Referenced by _update_state().
|
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().
|
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().
|
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().
|
private |
Definition at line 165 of file LandDetector.cpp.
References _total_flight_time.
Referenced by _update_params().
|
inlinestatic |
Definition at line 79 of file LandDetector.h.
References print_status(), print_usage(), and start().
|
private |
|
override |
Definition at line 104 of file land_detector_main.cpp.
|
static |
Definition at line 109 of file land_detector_main.cpp.
Referenced by task_spawn().
|
overrideprivate |
Definition at line 64 of file LandDetector.cpp.
References _actuator_armed, _actuator_armed_sub, _cycle_perf, _freefall_hysteresis, _get_max_altitude(), _ground_contact_hysteresis, _ground_effect_hysteresis, _land_detected, _landed_hysteresis, _maybe_landed_hysteresis, _parameter_update_sub, _previous_armed_state, _takeoff_time, _total_flight_time, _update_params(), _update_state(), _update_topics(), _vehicle_land_detected_pub, vehicle_land_detected_s::alt_max, actuator_armed_s::armed, FLT_EPSILON, vehicle_land_detected_s::freefall, systemlib::Hysteresis::get_state(), vehicle_land_detected_s::ground_contact, hrt_absolute_time(), hrt_abstime, hrt_elapsed_time(), vehicle_land_detected_s::in_ground_effect, vehicle_land_detected_s::landed, vehicle_land_detected_s::maybe_landed, perf_begin(), perf_end(), uORB::Publication< T >::publish(), vehicle_land_detected_s::timestamp, uORB::Subscription::update(), and uORB::Subscription::updated().
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().
|
static |
Definition at line 61 of file land_detector_main.cpp.
References land_detector::_currentMode, print_usage(), and start().
|
protected |
Definition at line 148 of file LandDetector.h.
Referenced by land_detector::MulticopterLandDetector::_get_ground_contact_state(), land_detector::RoverLandDetector::_get_landed_state(), land_detector::VtolLandDetector::_get_landed_state(), land_detector::FixedwingLandDetector::_get_landed_state(), land_detector::MulticopterLandDetector::_get_landed_state(), land_detector::VtolLandDetector::_get_maybe_landed_state(), land_detector::MulticopterLandDetector::_get_maybe_landed_state(), _update_topics(), and Run().
|
private |
Definition at line 179 of file LandDetector.h.
Referenced by _update_topics(), and Run().
|
private |
Definition at line 177 of file LandDetector.h.
Referenced by Run(), and ~LandDetector().
|
protected |
Definition at line 142 of file LandDetector.h.
Referenced by land_detector::MulticopterLandDetector::_update_params(), _update_state(), and Run().
|
protected |
Definition at line 145 of file LandDetector.h.
Referenced by land_detector::MulticopterLandDetector::_get_maybe_landed_state(), _update_state(), land_detector::MulticopterLandDetector::MulticopterLandDetector(), and Run().
|
protected |
Definition at line 146 of file LandDetector.h.
Referenced by _update_state(), and Run().
|
protected |
Definition at line 151 of file LandDetector.h.
Referenced by Run().
|
protected |
Definition at line 143 of file LandDetector.h.
Referenced by _update_state(), land_detector::FixedwingLandDetector::FixedwingLandDetector(), land_detector::MulticopterLandDetector::MulticopterLandDetector(), and Run().
|
protected |
Definition at line 144 of file LandDetector.h.
Referenced by land_detector::MulticopterLandDetector::_get_landed_state(), _update_state(), land_detector::MulticopterLandDetector::MulticopterLandDetector(), and Run().
|
private |
Definition at line 180 of file LandDetector.h.
Referenced by _update_params(), and Run().
|
private |
stores the previous actuator_armed.armed state
Definition at line 172 of file LandDetector.h.
Referenced by Run().
|
private |
Definition at line 174 of file LandDetector.h.
Referenced by Run().
|
private |
total vehicle flight time in microseconds
Definition at line 175 of file LandDetector.h.
Referenced by _update_total_flight_time(), and Run().
|
protected |
Definition at line 149 of file LandDetector.h.
Referenced by land_detector::MulticopterLandDetector::_get_freefall_state(), land_detector::FixedwingLandDetector::_get_landed_state(), and _update_topics().
|
private |
Definition at line 181 of file LandDetector.h.
Referenced by _update_topics().
|
protected |
Definition at line 162 of file LandDetector.h.
Referenced by Run().
|
protected |
Definition at line 160 of file LandDetector.h.
Referenced by land_detector::MulticopterLandDetector::_get_ground_contact_state(), land_detector::FixedwingLandDetector::_get_landed_state(), land_detector::MulticopterLandDetector::_has_altitude_lock(), land_detector::MulticopterLandDetector::_has_position_lock(), and _update_topics().
|
private |
Definition at line 182 of file LandDetector.h.
Referenced by _update_topics().
|
staticprotected |
Run main land detector loop at this interval.
Definition at line 140 of file LandDetector.h.
Referenced by start().