diff --git a/hardware_interface/src/resource_manager.cpp b/hardware_interface/src/resource_manager.cpp index 2e8ccc7b1f..ecc460d172 100644 --- a/hardware_interface/src/resource_manager.cpp +++ b/hardware_interface/src/resource_manager.cpp @@ -767,6 +767,7 @@ void ResourceManager::load_urdf( const auto hardware_info = hardware_interface::parse_control_resources_from_urdf(urdf); if (load_and_initialize_components) { + std::lock_guard resource_guard(resources_lock_); for (const auto & individual_hardware_info : hardware_info) { if (individual_hardware_info.type == actuator_type) @@ -1287,6 +1288,7 @@ return_type ResourceManager::set_component_state( return false; }; + std::lock_guard guard(resources_lock_); bool found = find_set_component_state( std::bind(&ResourceStorage::set_component_state, resource_storage_.get(), _1, _2), resource_storage_->actuators_);