mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 02:13:35 +08: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.
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <px4_module.h>
|
||||
#include <systemlib/hysteresis/hysteresis.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/topics/vehicle_land_detected.h>
|
||||
|
||||
@@ -175,6 +176,8 @@ private:
|
||||
hrt_abstime _takeoff_time;
|
||||
|
||||
struct work_s _work;
|
||||
|
||||
perf_counter_t _cycle_perf;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user