diff --git a/ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp b/ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp index 6fc227766..f7167e793 100644 --- a/ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp +++ b/ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp @@ -190,7 +190,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface bool first_pass_; bool initialized_; double system_interface_initialized_; - bool async_thread_shutdown_; + std::atomic_bool async_thread_shutdown_; double get_robot_software_version_major_; double get_robot_software_version_minor_; double get_robot_software_version_bugfix_; diff --git a/ur_robot_driver/src/hardware_interface.cpp b/ur_robot_driver/src/hardware_interface.cpp index b682bfd9b..2852df1b4 100644 --- a/ur_robot_driver/src/hardware_interface.cpp +++ b/ur_robot_driver/src/hardware_interface.cpp @@ -532,6 +532,7 @@ void URPositionHardwareInterface::readBitsetData(const std::unique_ptr g_log_handler(new UrclLogHandler); UrclLogHandler::UrclLogHandler() = default; @@ -82,10 +81,11 @@ void UrclLogHandler::log(const char* file, int line, urcl::LogLevel loglevel, co void registerUrclLogHandler(const std::string& tf_prefix) { if (g_registered == false) { - g_log_handler->setTFPrefix(tf_prefix); + std::unique_ptr log_handler(new UrclLogHandler); + log_handler->setTFPrefix(tf_prefix); // Log level is decided by ROS2 log level urcl::setLogLevel(urcl::LogLevel::DEBUG); - urcl::registerLogHandler(std::move(g_log_handler)); + urcl::registerLogHandler(std::move(log_handler)); g_registered = true; } }