mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 07:11:35 +08:00
Added room in land_detector code for free-fall detection
This commit is contained in:
@@ -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__
|
||||
|
||||
Reference in New Issue
Block a user