LandDetector: switch to uORB::Publication

This commit is contained in:
Matthias Grob
2019-10-16 00:47:01 -04:00
committed by Daniel Agar
parent 679e4fedf5
commit 45a53726d6
2 changed files with 3 additions and 5 deletions
+1 -4
View File
@@ -81,7 +81,6 @@ void LandDetector::Run()
// publish at 1 Hz, very first time, or when the result has changed
if ((hrt_elapsed_time(&_land_detected.timestamp) >= 1_s) ||
(_land_detected_pub == nullptr) ||
(_land_detected.landed != landDetected) ||
(_land_detected.freefall != freefallDetected) ||
(_land_detected.maybe_landed != maybe_landedDetected) ||
@@ -102,9 +101,7 @@ void LandDetector::Run()
_land_detected.alt_max = alt_max;
_land_detected.in_ground_effect = in_ground_effect;
int instance;
orb_publish_auto(ORB_ID(vehicle_land_detected), &_land_detected_pub, &_land_detected,
&instance, ORB_PRIO_DEFAULT);
_vehicle_land_detected_pub.publish(_land_detected);
}
// set the flight time when disarming (not necessarily when landed, because all param changes should
+2 -1
View File
@@ -54,6 +54,7 @@
#include <px4_module_params.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <uORB/Subscription.hpp>
#include <uORB/Publication.hpp>
#include <uORB/topics/actuator_armed.h>
#include <uORB/topics/parameter_update.h>
#include <uORB/topics/sensor_bias.h>
@@ -157,7 +158,7 @@ protected:
};
vehicle_local_position_s _vehicle_local_position{};
orb_advert_t _land_detected_pub{nullptr};
uORB::Publication<vehicle_land_detected_s> _vehicle_land_detected_pub{ORB_ID(vehicle_land_detected)};
uORB::Subscription _actuator_armed_sub{ORB_ID(actuator_armed)};
uORB::Subscription _vehicle_acceleration_sub{ORB_ID(vehicle_acceleration)};