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
+13 -1
View File
@@ -45,6 +45,15 @@
#include <uORB/uORB.h>
#include <uORB/topics/vehicle_land_detected.h>
namespace landdetection
{
enum LandDetectionResult {
LANDDETECTION_RES_FLYING = 0, /**< UAV is flying */
LANDDETECTION_RES_LANDED = 1, /**< Land has been detected */
LANDDETECTION_RES_FREEFALL = 2 /**< Free-fall has been detected */
};
class LandDetector
{
public:
@@ -81,7 +90,7 @@ protected:
* @brief Pure abstract method that must be overriden by sub-classes. This actually runs the underlying algorithm
* @return true if a landing was detected and this should be broadcast to the rest of the system
**/
virtual bool update() = 0;
virtual LandDetectionResult update() = 0;
/**
* @brief Pure abstract method that is called by this class once for initializing the uderlying algorithm (memory allocation,
@@ -106,6 +115,7 @@ protected:
orb_advert_t _landDetectedPub; /**< publisher for position in local frame */
struct vehicle_land_detected_s _landDetected; /**< local vehicle position */
uint64_t _arming_time; /**< timestamp of arming time */
LandDetectionResult _state; /**< Result of land detection. Can be LANDDETECTION_RES_FLYING, LANDDETECTION_RES_LANDED or LANDDETECTION_RES_FREEFALL */
private:
bool _taskShouldExit; /**< true if it is requested that this task should exit */
@@ -115,4 +125,6 @@ private:
void cycle();
};
}
#endif //__LAND_DETECTOR_H__