From 2ef601edd52967c197ebe9663c9d2560e4d208a2 Mon Sep 17 00:00:00 2001 From: Manuel Muth Date: Wed, 5 Jun 2024 14:15:00 +0200 Subject: [PATCH] forget to only publish if try lock is successfull --- hardware_interface/src/resource_manager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hardware_interface/src/resource_manager.cpp b/hardware_interface/src/resource_manager.cpp index e51b95040c..5eeb8509cf 100644 --- a/hardware_interface/src/resource_manager.cpp +++ b/hardware_interface/src/resource_manager.cpp @@ -1352,9 +1352,11 @@ void ResourceManager::publish_all_interface_values() const interface_values.states = state_interface_values; interface_values.commands = command_interface_values; - rt_interface_values_publisher_->trylock(); - rt_interface_values_publisher_->msg_ = interface_values; - rt_interface_values_publisher_->unlockAndPublish(); + if(rt_interface_values_publisher_->trylock()) + { + rt_interface_values_publisher_->msg_ = interface_values; + rt_interface_values_publisher_->unlockAndPublish(); + } } // CM API: Called in "update"-thread