mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 14:24:21 +08:00
FW Land Detector: force to landed if currently landed and in launch process
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -99,9 +99,6 @@ private:
|
||||
*/
|
||||
uint _state{launch_detection_status_s::STATE_WAITING_FOR_LAUNCH};
|
||||
|
||||
// [us] logs the last time the launch detection notification was sent (used not to spam notifications during launch detection)
|
||||
hrt_abstime _last_time_launch_detection_notified{0};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamBool<px4::params::LAUN_ALL_ON>) _param_laun_all_on,
|
||||
(ParamFloat<px4::params::LAUN_CAT_A>) _param_laun_cat_a,
|
||||
|
||||
@@ -60,7 +60,16 @@ bool FixedwingLandDetector::_get_landed_state()
|
||||
|
||||
bool landDetected = false;
|
||||
|
||||
if (hrt_elapsed_time(&_vehicle_local_position.timestamp) < 1_s) {
|
||||
launch_detection_status_s launch_detection_status{};
|
||||
_launch_detection_status_sub.copy(&launch_detection_status);
|
||||
|
||||
// force the landed state to stay landed if we're currently in the catapult/hand-launch launch process. Detect that we are in this state
|
||||
// by checking if the last publication of launch_detection_status is less than 0.5s old, and we're not yet in the flying state.
|
||||
if (_landed_hysteresis.get_state() && hrt_elapsed_time(&launch_detection_status.timestamp) < 500_ms
|
||||
&& launch_detection_status.launch_detection_state < launch_detection_status_s::STATE_FLYING) {
|
||||
landDetected = true;
|
||||
|
||||
} else if (hrt_elapsed_time(&_vehicle_local_position.timestamp) < 1_s) {
|
||||
|
||||
// Horizontal velocity complimentary filter.
|
||||
float val = 0.97f * _velocity_xy_filtered + 0.03f * sqrtf(_vehicle_local_position.vx * _vehicle_local_position.vx +
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <matrix/math.hpp>
|
||||
#include <uORB/topics/airspeed_validated.h>
|
||||
#include <uORB/topics/launch_detection_status.h>
|
||||
|
||||
#include "LandDetector.h"
|
||||
|
||||
@@ -68,6 +69,7 @@ private:
|
||||
static constexpr hrt_abstime FLYING_TRIGGER_TIME_US = 0_us;
|
||||
|
||||
uORB::Subscription _airspeed_validated_sub{ORB_ID(airspeed_validated)};
|
||||
uORB::Subscription _launch_detection_status_sub{ORB_ID(launch_detection_status)};
|
||||
|
||||
float _airspeed_filtered{0.0f};
|
||||
float _velocity_xy_filtered{0.0f};
|
||||
|
||||
Reference in New Issue
Block a user