File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
ros2_control_demo_hardware/src Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -177,12 +177,14 @@ hardware_interface::return_type DiffBotSystemHardware::read()
177177 rclcpp::get_logger (" DiffBotSystemHardware" ),
178178 " Reading..." );
179179
180- for (uint i = 0 ; i < hw_states_ .size (); i++) {
180+ for (uint i = 0 ; i < hw_commands_ .size (); i++) {
181181 // Simulate DiffBot's movement
182- hw_states_[i] = hw_commands_[i] + (hw_states_[i] - hw_commands_[i]) / hw_slowdown_;
182+ hw_states_[1 ] = hw_commands_[i] + (hw_states_[1 ] - hw_commands_[i]) / hw_slowdown_;
183+ hw_states_[0 ] += hw_states_[1 ] / 2 ;
183184 RCLCPP_INFO (
184185 rclcpp::get_logger (" DiffBotSystemHardware" ),
185- " Got state %.5f for '%s'!" , hw_states_[i], info_.joints [i].name .c_str ());
186+ " Got position state %.5f and velocity state %.5f for '%s'!" ,
187+ hw_states_[0 ], hw_states_[1 ], info_.joints [i].name .c_str ());
186188 }
187189 RCLCPP_INFO (
188190 rclcpp::get_logger (" DiffBotSystemHardware" ),
You can’t perform that action at this time.
0 commit comments