Skip to content

Commit 3e56614

Browse files
Fixes eager interface claiming bug in franka_hardware
1 parent 39df9c1 commit 3e56614

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

franka_hardware/src/franka_hardware_interface.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,19 @@ hardware_interface::return_type FrankaHardwareInterface::perform_command_mode_sw
398398
hardware_interface::return_type FrankaHardwareInterface::prepare_command_mode_switch(
399399
const std::vector<std::string>& start_interfaces,
400400
const std::vector<std::string>& stop_interfaces) {
401-
auto contains_interface_type = [](const std::string& interface,
402-
const std::string& interface_type) {
401+
auto contains_interface_type = [this](const std::string& interface,
402+
const std::string& interface_type) {
403403
size_t slash_position = interface.find('/');
404404
if (slash_position != std::string::npos && slash_position + 1 < interface.size()) {
405405
std::string after_slash = interface.substr(slash_position + 1);
406-
return after_slash == interface_type;
406+
std::string before_slash = interface.substr(0, slash_position - 1);
407+
if (after_slash == interface_type) {
408+
for (const auto& joint : this->info_.joints) {
409+
if (before_slash == joint.name) {
410+
return true;
411+
}
412+
}
413+
}
407414
}
408415
return false;
409416
};

0 commit comments

Comments
 (0)