mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:33:34 +08:00
Added room in land_detector code for free-fall detection
This commit is contained in:
@@ -46,6 +46,9 @@
|
||||
#include <cmath>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
namespace landdetection
|
||||
{
|
||||
|
||||
FixedwingLandDetector::FixedwingLandDetector() : LandDetector(),
|
||||
_paramHandle(),
|
||||
_params(),
|
||||
@@ -84,11 +87,30 @@ void FixedwingLandDetector::updateSubscriptions()
|
||||
orb_update(ORB_ID(airspeed), _airspeedSub, &_airspeed);
|
||||
}
|
||||
|
||||
bool FixedwingLandDetector::update()
|
||||
LandDetectionResult FixedwingLandDetector::update()
|
||||
{
|
||||
// First poll for new data from our subscriptions
|
||||
updateSubscriptions();
|
||||
|
||||
if (get_freefall_state()) {
|
||||
_state = LANDDETECTION_RES_FREEFALL;
|
||||
}else if(get_landed_state()){
|
||||
_state = LANDDETECTION_RES_LANDED;
|
||||
}else{
|
||||
_state = LANDDETECTION_RES_FLYING;
|
||||
}
|
||||
|
||||
return _state;
|
||||
}
|
||||
|
||||
bool FixedwingLandDetector::get_freefall_state()
|
||||
{
|
||||
//TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FixedwingLandDetector::get_landed_state()
|
||||
{
|
||||
// only trigger flight conditions if we are armed
|
||||
if (!_arming.armed) {
|
||||
return true;
|
||||
@@ -159,3 +181,5 @@ void FixedwingLandDetector::updateParameterCache(const bool force)
|
||||
param_get(_paramHandle.maxIntVelocity, &_params.maxIntVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user