From 6bae4e01930f04fc50928977715f1fccb86622ea Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Fri, 27 Feb 2026 06:40:26 +0100 Subject: [PATCH 1/3] fix(controllers): safe interface map check --- source/modulo_controllers/src/RobotControllerInterface.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/modulo_controllers/src/RobotControllerInterface.cpp b/source/modulo_controllers/src/RobotControllerInterface.cpp index d0c52717..cda655ca 100644 --- a/source/modulo_controllers/src/RobotControllerInterface.cpp +++ b/source/modulo_controllers/src/RobotControllerInterface.cpp @@ -27,7 +27,7 @@ RobotControllerInterface::RobotControllerInterface( new_joint_command_ready_(false), command_decay_factor_(0.0), command_rate_limit_(std::numeric_limits::infinity()) { - if (!control_type.empty() && interface_map.find(control_type) == interface_map.cend()) { + if (!control_type.empty() && interface_map.count(control_type) == 0) { RCLCPP_ERROR(get_node()->get_logger(), "Invalid control type: %s", control_type.c_str()); throw std::invalid_argument("Invalid control type: " + control_type); } @@ -233,6 +233,9 @@ controller_interface::return_type RobotControllerInterface::read_state_interface joint.c_str(), interface.c_str()); return controller_interface::return_type::ERROR; } + if (interface_map.count(interface) == 0) { + continue; + } switch (interface_map.at(interface)) { case JointStateVariable::POSITIONS: joint_state_.set_position(value, joint_index); @@ -387,7 +390,7 @@ void RobotControllerInterface::set_control_type(const std::string& control_type) if (control_type_fixed_) { throw std::runtime_error("Control type is fixed and cannot be changed anymore"); } - if (!control_type.empty() && interface_map.find(control_type) == interface_map.cend()) { + if (!control_type.empty() && interface_map.count(control_type) == 0) { throw std::runtime_error("Invalid control type: " + control_type); } control_type_ = control_type; From 1ee340e7c4403fe38dc69654053623d71ed91805 Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Fri, 27 Feb 2026 06:43:24 +0100 Subject: [PATCH 2/3] docs: changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6095d8c..d2e534df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,11 @@ Release Versions: - [2.1.1](#211) - [2.1.0](#210) +## Upcoming changes + +- fix(controllers): safe interface map check (#233) + + ## 5.3.0 ### January 13th, 2026 From b9328c3ee827607b9fe0db0359040ca5250e042e Mon Sep 17 00:00:00 2001 From: Dominic Reber <71256590+domire8@users.noreply.github.com> Date: Fri, 27 Feb 2026 06:44:25 +0100 Subject: [PATCH 3/3] fix: newline --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e534df..8846fa59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,6 @@ Release Versions: - fix(controllers): safe interface map check (#233) - ## 5.3.0 ### January 13th, 2026