mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
roboclaw update orb_publish usage to uORB::PublicationMulti<>
This commit is contained in:
parent
55a3128c7d
commit
7306767a9d
@ -228,14 +228,7 @@ void RoboClaw::taskMain()
|
||||
_wheelEncoderMsg[i].encoder_position = _encoderCounts[i];
|
||||
_wheelEncoderMsg[i].speed = _motorSpeeds[i];
|
||||
|
||||
if (_wheelEncodersAdv[i] == nullptr) {
|
||||
int instance;
|
||||
_wheelEncodersAdv[i] = orb_advertise_multi(ORB_ID(wheel_encoders), &_wheelEncoderMsg[i],
|
||||
&instance, ORB_PRIO_DEFAULT);
|
||||
|
||||
} else {
|
||||
orb_publish(ORB_ID(wheel_encoders), _wheelEncodersAdv[i], &_wheelEncoderMsg[i]);
|
||||
}
|
||||
_wheelEncodersAdv[i].publish(_wheelEncoderMsg[i]);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#include <lib/parameters/param.h>
|
||||
#include <uORB/PublicationMulti.hpp>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/wheel_encoders.h>
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
@ -204,7 +205,7 @@ private:
|
||||
int _paramSub{-1};
|
||||
parameter_update_s _paramUpdate;
|
||||
|
||||
orb_advert_t _wheelEncodersAdv[2] {nullptr, nullptr};
|
||||
uORB::PublicationMulti<wheel_encoders_s> _wheelEncodersAdv[2] { ORB_ID(wheel_encoders), ORB_ID(wheel_encoders)};
|
||||
wheel_encoders_s _wheelEncoderMsg[2];
|
||||
|
||||
uint32_t _lastEncoderCount[2] {0, 0};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user