Added room in land_detector code for free-fall detection

This commit is contained in:
Emmanuel Roussel
2016-04-18 22:27:11 +02:00
committed by Roman
parent e70804c9d0
commit 35110a52f9
10 changed files with 118 additions and 11 deletions
@@ -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);
}
}
}