28 #include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
29 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
31 #include "../RobotUnitObserver.h"
36 struct ControlThreadOutputBufferEntry;
52 defineOptionalProperty<std::string>(
"RobotUnitListenerTopicName",
53 "RobotUnitListenerTopic",
54 "The topic receiving events for RobotUnitListener");
55 defineOptionalProperty<std::string>(
"DebugDrawerUpdatesTopicName",
57 "The topic receiving events for debug drawing");
58 defineOptionalProperty<std::size_t>(
59 "PublishPeriodMs", 10,
"Milliseconds between each publish");
61 defineOptionalProperty<bool>(
"ObserverEnablePublishing",
63 "Whether the publishing thread is started or not",
65 defineOptionalProperty<bool>(
"ObserverPublishSensorValues",
67 "Whether sensor values are send to the observer",
69 defineOptionalProperty<bool>(
"ObserverPublishControlTargets",
71 "Whether control targets are send to the observer",
73 defineOptionalProperty<bool>(
"ObserverPublishTimingInformation",
75 "Whether timing information are send to the observer",
77 defineOptionalProperty<bool>(
"ObserverPublishAdditionalInformation",
79 "Whether additional information are send to the observer",
81 defineOptionalProperty<std::string>(
82 "DebugObserverTopicName",
"DebugObserver",
"The topic where updates are send to");
83 defineOptionalProperty<std::uint64_t>(
84 "ObserverPrintEveryNthIterations",
86 "Only every nth iteration data is send to the debug observer",
110 return ModuleBase::Instance<Publisher>();
118 void _icePropertiesInitialized();
120 void _componentPropertiesUpdated(
const std::set<std::string>& changedProperties);
123 void _preOnInitRobotUnit();
125 void _preOnConnectRobotUnit();
127 void _postFinishControlThreadInitialization();
129 void _preFinishRunning();
189 const RobotUnitObserverPtr&
190 getRobotUnitObserver()
const
193 return robotUnitObserver;
221 const JointAndNJointControllers& activatedControllers);
234 bool haveSensorAndControlValsChanged,
235 bool publishToObserver,
236 const JointAndNJointControllers& activatedControllers,
237 const std::vector<JointController*>& requestedJointControllers);
250 static constexpr
int spamdelay = 30;
255 std::string robotUnitListenerTopicName;
257 std::string debugDrawerUpdatesTopicName;
259 std::string debugObserverTopicName;
267 std::uint64_t publishIterationCount{0};
272 PublisherTaskT::pointer_type publisherTask;
274 std::set<std::string> lastReportedClasses;
277 std::atomic_bool observerPublishSensorValues;
279 std::atomic_bool observerEnablePublishing;
281 std::atomic_bool observerPublishControlTargets;
283 std::atomic_bool observerPublishTimingInformation;
285 std::atomic_bool observerPublishAdditionalInformation;
288 std::atomic<std::uint64_t> debugObserverSkipIterations;
295 RobotUnitObserverPtr robotUnitObserver;
298 std::size_t publishPeriodMs{1};
301 RobotUnitListenerPrx robotUnitListenerPrx;
304 RobotUnitListenerPrx robotUnitListenerBatchPrx;