ros-controls / gz_ros2_control

Connect the latest version of Gazebo with ros2_control.
https://gazebosim.org
Apache License 2.0
115 stars 86 forks source link

ros2_control doesn't move prismatic joint against gravity #192

Closed mikramarc closed 5 months ago

mikramarc commented 11 months ago

Hi! Not sure if this is a bug, or if I'm doing something wrong, but I'm trying to set up a ROS2 controller for a Stretch robot's manipulator. Everything seems to be working well, joints moving as expected when msg is published to joint_trajectory, apart from this one joint which is perpendicular to the ground - it does not move at all. However, when I collapse the robot on it's side or I reduce gravity in my world file, the joints starts moving, which to me suggests that there is not enough force to move the link up against the gravity. Any idea what could be happening here? I tried to up the controller gain in my controllers yaml file, but that did not help. I can't really share my whole code, but happy to provide more info that could shed more light on this. Any help or suggestions would be much appreciated, thanks!

My setup: Ubuntu 20.04 ROS2 Humble Plugin for control: name='ign_ros2_control::IgnitionROS2ControlPlugin' filename='ign_ros2_control-system'

mikramarc commented 11 months ago

OK, after further investigation it seems that it's not the gravity that is the problem - when I spawn the robot the joint very temporarily moves outside of the 0.0 limit - the one set for joints in urdf - (to something like -0.002), but that's enough to completely render the controller unusable. The joint just won't move once it goes outside the limit. Same goes for other joints actually - if I ever hit a limit for any of them, they will just stop moving afterwards, the only way to recover from that would be to "shake" the robot so the joint goes back from outside the limit that way. I can prevent that blocking from happening by modifying the limit in the urdf allowing slight negative values, but that seems quite hacky. Anyone encountered that behavior before? Any advice?

mrjogo commented 8 months ago

I believe this is the same issue as https://github.com/ros-controls/gz_ros2_control/issues/165

mrjogo commented 8 months ago

Specific to gravity triggering the joint limit issue, the #241 fix and setting a non-limit initial position seems to fix the problem.

mindestalter commented 5 months ago

Hi, I have the same issue while using the forward_command_controller/ForwardCommandController. The problem can occur, when the controller is given the limits as the positional target. My setup is:

Ubuntu 22.04 ROS2 Iron Plugin for control: filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin"

christophfroehlich commented 5 months ago

Which gazebo version are you using? See https://github.com/ros-controls/gz_ros2_control/issues/165#issuecomment-1958180051

mindestalter commented 5 months ago

I am using Ignition Gazebo v6.16.0

christophfroehlich commented 5 months ago

v6 is Fortress. As @azeey has written in the linked issue, this has been fixed for harmonic only.

I'm tempted to close this issue as it seems to be not related with gz_ros2_control but with gz_sim itself.