mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
land detector add cycle perf
This commit is contained in:
@@ -47,11 +47,9 @@
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include "uORB/topics/parameter_update.h"
|
||||
|
||||
|
||||
namespace land_detector
|
||||
{
|
||||
|
||||
|
||||
LandDetector::LandDetector() :
|
||||
_landDetectedPub(nullptr),
|
||||
_landDetected{0, false, false},
|
||||
@@ -63,12 +61,14 @@ LandDetector::LandDetector() :
|
||||
_ground_contact_hysteresis(true),
|
||||
_total_flight_time{0},
|
||||
_takeoff_time{0},
|
||||
_work{}
|
||||
_work{},
|
||||
_cycle_perf(perf_alloc(PC_ELAPSED, "land_detector_cycle"))
|
||||
{
|
||||
}
|
||||
|
||||
LandDetector::~LandDetector()
|
||||
{
|
||||
perf_free(_cycle_perf);
|
||||
}
|
||||
|
||||
int LandDetector::start()
|
||||
@@ -87,6 +87,8 @@ LandDetector::_cycle_trampoline(void *arg)
|
||||
|
||||
void LandDetector::_cycle()
|
||||
{
|
||||
perf_begin(_cycle_perf);
|
||||
|
||||
if (!_object) { // not initialized yet
|
||||
// Advertise the first land detected uORB.
|
||||
_landDetected.timestamp = hrt_absolute_time();
|
||||
@@ -155,6 +157,8 @@ void LandDetector::_cycle()
|
||||
&instance, ORB_PRIO_DEFAULT);
|
||||
}
|
||||
|
||||
perf_end(_cycle_perf);
|
||||
|
||||
if (!should_exit()) {
|
||||
|
||||
// Schedule next cycle.
|
||||
|
||||
Reference in New Issue
Block a user