Skip to content
Snippets Groups Projects
Commit 2ae5e575 authored by Daniel Agar's avatar Daniel Agar Committed by Lorenz Meier
Browse files

land detector initialize landed and publish periodically

parent fd3f59d8
No related branches found
No related tags found
No related merge requests found
......@@ -82,7 +82,7 @@ void LandDetector::_cycle()
// Advertise the first land detected uORB.
_landDetected.timestamp = hrt_absolute_time();
_landDetected.freefall = false;
_landDetected.landed = false;
_landDetected.landed = true;
_landDetected.ground_contact = false;
_landDetected.maybe_landed = false;
......@@ -111,8 +111,9 @@ void LandDetector::_cycle()
const hrt_abstime now = hrt_absolute_time();
// Only publish very first time or when the result has changed.
if ((_landDetectedPub == nullptr) ||
// publish at 1 Hz, very first time, or when the result has changed
if ((hrt_elapsed_time(&_landDetected.timestamp) >= 1000000) ||
(_landDetectedPub == nullptr) ||
(_landDetected.landed != landDetected) ||
(_landDetected.freefall != freefallDetected) ||
(_landDetected.maybe_landed != maybe_landedDetected) ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment