Skip to content

Commit 49976e0

Browse files
Fixes eager interface claiming bug in franka_hardware
1 parent 39df9c1 commit 49976e0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

franka_hardware/src/franka_hardware_interface.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,25 @@ 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);
407+
408+
if (after_slash == interface_type) {
409+
if (interface_type != "position" && interface_type != "velocity" &&
410+
interface_type != "effort" && interface_type != "acceleration") {
411+
return true;
412+
}
413+
414+
for (const auto& joint : this->info_.joints) {
415+
if (before_slash == joint.name) {
416+
return true;
417+
}
418+
}
419+
}
407420
}
408421
return false;
409422
};

0 commit comments

Comments
 (0)