Skip to content

Commit 714f0f0

Browse files
committed
adapt example 1 to stored handle-names/descriptions in map
1 parent e66b7a8 commit 714f0f0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

example_1/hardware/rrbot.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_configure
101101
// END: This part here is for exemplary purposes - Please do not copy to your production code
102102

103103
// reset values always when configuring hardware
104-
for (const auto & descr : joint_states_descriptions_)
104+
for (const auto & [name, descr] : joint_state_interfaces_)
105105
{
106106
joint_state_set_value(descr, 0.0);
107107
}
108-
for (const auto & descr : joint_commands_descriptions_)
108+
for (const auto & [name, descr] : joint_command_interfaces_)
109109
{
110110
joint_command_set_value(descr, 0.0);
111111
}
@@ -131,7 +131,7 @@ hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_activate(
131131
// END: This part here is for exemplary purposes - Please do not copy to your production code
132132

133133
// command and state should be equal when starting
134-
for (const auto & descr : joint_states_descriptions_)
134+
for (const auto & [name, descr] : joint_state_interfaces_)
135135
{
136136
joint_command_set_value(descr, joint_state_get_value(descr));
137137
}
@@ -168,7 +168,7 @@ hardware_interface::return_type RRBotSystemPositionOnlyHardware::read(
168168
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
169169
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Reading...");
170170

171-
for (const auto & descr : joint_states_descriptions_)
171+
for (const auto & [name, descr] : joint_state_interfaces_)
172172
{
173173
auto new_value = joint_state_get_value(descr) +
174174
(joint_command_get_value(descr) - joint_state_get_value(descr)) / hw_slowdown_;
@@ -190,7 +190,7 @@ hardware_interface::return_type RRBotSystemPositionOnlyHardware::write(
190190
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
191191
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Writing...");
192192

193-
for (const auto & descr : joint_commands_descriptions_)
193+
for (const auto & [name, descr] : joint_command_interfaces_)
194194
{
195195
// Simulate sending commands to the hardware
196196
RCLCPP_INFO_STREAM(

0 commit comments

Comments
 (0)