diff --git a/hardware_interface/src/resource_manager.cpp b/hardware_interface/src/resource_manager.cpp index 06c56b4cce..487a6cacb5 100644 --- a/hardware_interface/src/resource_manager.cpp +++ b/hardware_interface/src/resource_manager.cpp @@ -685,8 +685,8 @@ void ResourceManager::load_urdf( const std::string actuator_type = "actuator"; const auto hardware_info = hardware_interface::parse_control_resources_from_urdf(urdf); + std::lock_guard resource_guard(resources_lock_); if (load_and_initialize_components) - std::lock_guard resource_guard(resources_lock_); { for (const auto & individual_hardware_info : hardware_info) { @@ -716,7 +716,6 @@ void ResourceManager::load_urdf( validate_storage(hardware_info); } - std::lock_guard guard(resources_lock_); read_write_status.failed_hardware_names.reserve( resource_storage_->actuators_.size() + resource_storage_->sensors_.size() + resource_storage_->systems_.size());