ros-controls / ros2_control_demos

This repository aims at providing examples to illustrate ros2_control and ros2_controllers
https://control.ros.org
Apache License 2.0
367 stars 175 forks source link

RRBot unable to reach desired joint positions before /forward_position_controller requests new joint position in Example 1 #532

Closed logdog closed 3 weeks ago

logdog commented 3 weeks ago

Describe the bug The /forward_position_controller in Example 1 requests a new joint position every 5 seconds. However, the rrbot is unable to reach the desired joint position within 5 seconds. As a result, the rrbot is constantly moving, and does not achieve the desired joint positions. This does not seem to be the desired behavior of the tutorial.

To Reproduce Steps to reproduce the behavior:

  1. In terminal 1, run ros2 launch ros2_control_demo_example_1 rrbot.launch.py
  2. In terminal 2, run ros2 launch ros2_control_demo_example_1 test_forward_position_controller.launch.py
  3. In rviz, observe that the rrbot is unable to reach the desired joint positions before the /forward_position_controller requests a new position.

Expected behavior The rrbot should be able to reach the desired joint position within the 5 second window. To fix, the rrbot should move its joints faster so that the desired position is reached within the 5 second window, or the /forward_position_controller should have a longer default time between requests.

If the robot moving slowly is intended behavior, perhaps an instruction on how to increase the speed of the arm can be included in the tutorial so new users can learn.

Environment (please complete the following information):

Additional context Please note that the same problem occurs when using the /joint_trajectory_controller in the tutorial.

christophfroehlich commented 3 weeks ago

I think this was an accepted behavior when this example was written. But feel free to add an PR to change this. However, the current implementation of the "dynamics" has almost infinite settling time. hw_states_[i] = hw_states_[i] + (hw_commands_[i] - hw_states_[i]) / hw_slowdown_;