diff --git a/hardware_interface/src/resource_manager.cpp b/hardware_interface/src/resource_manager.cpp index e585571d35..06c56b4cce 100644 --- a/hardware_interface/src/resource_manager.cpp +++ b/hardware_interface/src/resource_manager.cpp @@ -686,6 +686,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) { @@ -1209,6 +1210,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_);