Skip to content

Commit eead98b

Browse files
committed
more bug fixes
1 parent ca69656 commit eead98b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

whole_body_controllers/src/ik_controller.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,27 @@ auto IKController::configure_parameters() -> controller_interface::CallbackRetur
118118
return std::ranges::find(interfaces, type) != interfaces.end();
119119
};
120120

121-
auto count_interfaces = [](bool use_interface, const std::vector<std::string> & interface_names, std::size_t & n) {
122-
n += use_interface ? interface_names.size() : 0;
123-
};
124-
125121
use_position_commands_ = has_interface(params_.command_interfaces, "position");
126122
use_velocity_commands_ = has_interface(params_.command_interfaces, "velocity");
127123

128-
count_interfaces(use_position_commands_, position_interface_names_, n_command_interfaces_);
129-
count_interfaces(use_velocity_commands_, velocity_interface_names_, n_command_interfaces_);
124+
n_command_interfaces_ = 0;
125+
if (use_position_commands_) {
126+
n_command_interfaces_ += position_interface_names_.size();
127+
}
128+
if (use_velocity_commands_) {
129+
n_command_interfaces_ += velocity_interface_names_.size();
130+
}
130131

131132
use_position_states_ = has_interface(params_.state_interfaces, "position");
132133
use_velocity_states_ = has_interface(params_.state_interfaces, "velocity");
133134

134-
count_interfaces(use_position_states_, position_interface_names_, n_state_interfaces_);
135-
count_interfaces(use_velocity_states_, velocity_interface_names_, n_state_interfaces_);
135+
n_state_interfaces_ = 0;
136+
if (use_position_states_) {
137+
n_state_interfaces_ += position_interface_names_.size();
138+
}
139+
if (use_velocity_states_) {
140+
n_state_interfaces_ += velocity_interface_names_.size();
141+
}
136142

137143
return controller_interface::CallbackReturn::SUCCESS;
138144
}

0 commit comments

Comments
 (0)