mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
pwm_out_sim: don't advertise garbage
This commit is contained in:
parent
f6a5c7cca9
commit
c8d13bacf2
@ -161,9 +161,6 @@ PWMSim::run()
|
||||
|
||||
_armed_sub = orb_subscribe(ORB_ID(actuator_armed));
|
||||
|
||||
/* advertise the mixed control outputs, insist on the first group output */
|
||||
_outputs_pub = orb_advertise(ORB_ID(actuator_outputs), &_actuator_outputs);
|
||||
|
||||
update_params();
|
||||
int params_sub = orb_subscribe(ORB_ID(parameter_update));
|
||||
|
||||
@ -293,9 +290,10 @@ PWMSim::run()
|
||||
orb_publish_auto(ORB_ID(multirotor_motor_limits), &_mixer_status, &motor_limits, &instance, ORB_PRIO_DEFAULT);
|
||||
}
|
||||
|
||||
/* and publish for anyone that cares to see */
|
||||
_actuator_outputs.timestamp = hrt_absolute_time();
|
||||
orb_publish(ORB_ID(actuator_outputs), _outputs_pub, &_actuator_outputs);
|
||||
|
||||
_outputs_pub.publish(_actuator_outputs);
|
||||
|
||||
|
||||
// use first valid timestamp_sample for latency tracking
|
||||
for (int i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) {
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
#include <px4_module.h>
|
||||
#include <px4_tasks.h>
|
||||
#include <px4_time.h>
|
||||
#include <uORB/Publication.hpp>
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/actuator_outputs.h>
|
||||
@ -109,8 +110,8 @@ private:
|
||||
|
||||
int _armed_sub{-1};
|
||||
|
||||
actuator_outputs_s _actuator_outputs = {};
|
||||
orb_advert_t _outputs_pub{nullptr};
|
||||
actuator_outputs_s _actuator_outputs {};
|
||||
uORB::Publication<actuator_outputs_s> _outputs_pub{ORB_ID(actuator_outputs)};
|
||||
orb_advert_t _mixer_status{nullptr};
|
||||
|
||||
unsigned _num_outputs{0};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user