@@ -740,8 +740,11 @@ class ResourceStorage
740
740
const std::string interface_name = joint_name + " /" + interface_type;
741
741
if (interface_map.find (interface_name) != interface_map.end ())
742
742
{
743
- // If the command interface is not claimed, then the value is not set
744
- if (is_command_itf && !claimed_command_interface_map_.at (interface_name))
743
+ // If the command interface is not claimed, then the value is not set (or) if the
744
+ // interface doesn't exist, then value is not set
745
+ if (
746
+ is_command_itf && (claimed_command_interface_map_.count (interface_name) == 0 ||
747
+ !claimed_command_interface_map_.at (interface_name)))
745
748
{
746
749
value = std::nullopt;
747
750
}
@@ -1446,6 +1449,7 @@ bool ResourceManager::load_and_initialize_components(
1446
1449
1447
1450
void ResourceManager::import_joint_limiters (const std::string & urdf)
1448
1451
{
1452
+ std::lock_guard<std::recursive_mutex> guard (joint_limiters_lock_);
1449
1453
const auto hardware_info = hardware_interface::parse_control_resources_from_urdf (urdf);
1450
1454
resource_storage_->import_joint_limiters (hardware_info);
1451
1455
}
@@ -2072,6 +2076,12 @@ return_type ResourceManager::set_component_state(
2072
2076
// CM API: Called in "update"-thread
2073
2077
bool ResourceManager::enforce_command_limits (const rclcpp::Duration & period)
2074
2078
{
2079
+ std::unique_lock<std::recursive_mutex> limiters_guard (joint_limiters_lock_, std::try_to_lock);
2080
+ if (!limiters_guard.owns_lock ())
2081
+ {
2082
+ return false ;
2083
+ }
2084
+
2075
2085
bool enforce_result = false ;
2076
2086
// Joint Limiters operations
2077
2087
for (auto & [hw_name, limiters] : resource_storage_->joint_limiters_interface_ )
0 commit comments