mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 12:23:33 +08:00
sensors: update orb_publish to uORB::Publication<>
This commit is contained in:
@@ -39,9 +39,6 @@
|
||||
|
||||
#include "rc_update.h"
|
||||
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/manual_control_setpoint.h>
|
||||
|
||||
using namespace sensors;
|
||||
|
||||
RCUpdate::RCUpdate(const Parameters ¶meters)
|
||||
@@ -316,14 +313,13 @@ RCUpdate::rc_poll(const ParameterHandles ¶meter_handles)
|
||||
_rc.frame_drop_count = rc_input.rc_lost_frame_count;
|
||||
|
||||
/* publish rc_channels topic even if signal is invalid, for debug */
|
||||
int instance;
|
||||
orb_publish_auto(ORB_ID(rc_channels), &_rc_pub, &_rc, &instance, ORB_PRIO_DEFAULT);
|
||||
_rc_pub.publish(_rc);
|
||||
|
||||
/* only publish manual control if the signal is still present and was present once */
|
||||
if (!signal_lost && rc_input.timestamp_last_signal > 0) {
|
||||
|
||||
/* initialize manual setpoint */
|
||||
struct manual_control_setpoint_s manual = {};
|
||||
manual_control_setpoint_s manual{};
|
||||
/* set mode slot to unassigned */
|
||||
manual.mode_slot = manual_control_setpoint_s::MODE_SLOT_NONE;
|
||||
/* set the timestamp to the last signal time */
|
||||
@@ -405,11 +401,10 @@ RCUpdate::rc_poll(const ParameterHandles ¶meter_handles)
|
||||
_parameters.rc_man_th, _parameters.rc_man_inv);
|
||||
|
||||
/* publish manual_control_setpoint topic */
|
||||
orb_publish_auto(ORB_ID(manual_control_setpoint), &_manual_control_pub, &manual, &instance,
|
||||
ORB_PRIO_HIGH);
|
||||
_manual_control_pub.publish(manual);
|
||||
|
||||
/* copy from mapped manual control to control group 3 */
|
||||
struct actuator_controls_s actuator_group_3 = {};
|
||||
actuator_controls_s actuator_group_3{};
|
||||
|
||||
actuator_group_3.timestamp = rc_input.timestamp_last_signal;
|
||||
|
||||
@@ -423,8 +418,7 @@ RCUpdate::rc_poll(const ParameterHandles ¶meter_handles)
|
||||
actuator_group_3.control[7] = manual.aux3;
|
||||
|
||||
/* publish actuator_controls_3 topic */
|
||||
orb_publish_auto(ORB_ID(actuator_controls_3), &_actuator_group_3_pub, &actuator_group_3, &instance,
|
||||
ORB_PRIO_DEFAULT);
|
||||
_actuator_group_3_pub.publish(actuator_group_3);
|
||||
|
||||
/* Update parameters from RC Channels (tuning with RC) if activated */
|
||||
if (hrt_elapsed_time(&_last_rc_to_param_map_time) > 1e6) {
|
||||
|
||||
Reference in New Issue
Block a user