Added room in land_detector code for free-fall detection

This commit is contained in:
Emmanuel Roussel
2016-01-27 18:17:13 +01:00
committed by Roman
parent e70804c9d0
commit 35110a52f9
10 changed files with 118 additions and 11 deletions
@@ -45,6 +45,9 @@
#include <drivers/drv_hrt.h>
#include <mathlib/mathlib.h>
namespace landdetection
{
MulticopterLandDetector::MulticopterLandDetector() : LandDetector(),
_paramHandle(),
_params(),
@@ -89,14 +92,28 @@ void MulticopterLandDetector::updateSubscriptions()
orb_update(ORB_ID(manual_control_setpoint), _manualSub, &_manual);
}
bool MulticopterLandDetector::update()
LandDetectionResult MulticopterLandDetector::update()
{
// first poll for new data from our subscriptions
updateSubscriptions();
updateParameterCache(false);
return get_landed_state();
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 MulticopterLandDetector::get_freefall_state()
{
//TODO
return false;
}
bool MulticopterLandDetector::get_landed_state()
@@ -183,3 +200,5 @@ void MulticopterLandDetector::updateParameterCache(const bool force)
param_get(_paramHandle.maxThrottle, &_params.maxThrottle);
}
}
}