diff --git a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.cpp b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.cpp index a98d34947959b80088f6cdb82be6aa4facdc07bd..4b9a12a21520e58e87f0038c808715be940b8584 100644 --- a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.cpp +++ b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.cpp @@ -476,6 +476,7 @@ namespace armarx::RobotUnitModule getProperty<std::string>("DebugDrawerUpdatesTopicName").getValue(); debugObserverTopicName = getProperty<std::string>("DebugObserverTopicName").getValue(); + observerEnablePublishing = getProperty<bool>("ObserverEnablePublishing").getValue(); observerPublishSensorValues = getProperty<bool>("ObserverPublishSensorValues").getValue(); observerPublishControlTargets = getProperty<bool>("ObserverPublishControlTargets").getValue(); @@ -575,7 +576,10 @@ namespace armarx::RobotUnitModule [&] { publish({}); }, publishPeriodMs, false, getName() + "_PublisherTask"); ARMARX_INFO << "starting publisher with timestep " << publishPeriodMs; publisherTask->setDelayWarningTolerance(10 * publishPeriodMs); - publisherTask->start(); + if (observerEnablePublishing) + { + publisherTask->start(); + } } void diff --git a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.h b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.h index 9f061fd02cad06539fb919e32087912f72713f6e..ffa451eb40630cf7f54e9e4966a93575d6c2fb98 100644 --- a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.h +++ b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModulePublisher.h @@ -58,6 +58,10 @@ namespace armarx::RobotUnitModule defineOptionalProperty<std::size_t>( "PublishPeriodMs", 10, "Milliseconds between each publish"); + defineOptionalProperty<bool>("ObserverEnablePublishing", + true, + "Whether the publishing thread is started or not", + PropertyDefinitionBase::eModifiable); defineOptionalProperty<bool>("ObserverPublishSensorValues", true, "Whether sensor values are send to the observer", @@ -271,6 +275,8 @@ namespace armarx::RobotUnitModule /// @brief Whether \ref SensorValueBase "SensorValues" should be published to the observers std::atomic_bool observerPublishSensorValues; + /// @brief Whether the publishing thread should be started or not + std::atomic_bool observerEnablePublishing; /// @brief Whether \ref ControlTargetBase "ControlTargets" should be published to the observers std::atomic_bool observerPublishControlTargets; /// @brief Whether \ref Timing information should be published to the observers