Allow position control limits outside [-pi,pi]#477
Allow position control limits outside [-pi,pi]#477scpeters wants to merge 1 commit intoros-controls:melodic-develfrom
Conversation
Several joint position controllers use the angles::shortest_angular_distance_with_limits function for REVOLUTE joints to compute the position error, but this function only supports joint limits within the interval [-pi, pi]. The angles::shortest_angular_distance_with_large_limits function supports limits outside the interval [-pi, pi], which I think is more suitable for this computation. Fixes ros-controls#261.
matthew-reynolds
left a comment
There was a problem hiding this comment.
LGTM but I think this should target Noetic since it changes behaviour. If people are taking advantage of the wrapping that angles::shortest_angular_distance_with_limits() does, then requiring lower < upper might make a mess for them.
|
#466 ? |
I don't think this repository has a |
Oops, you're right I didn't notice that when I made this PR. I believe this PR matches what is recommended in the following comment thread: #466 (comment) As I look back further, #264 is also related, but I think it predates the |
bump @bmagyar; if this should target |
|
never mind, #466 is a better version of this since it has a test. |
|
@matthew-reynolds while I agree that it changes behaviour slightly, some may say this is a bug, not a feature, even if people found ways to work around it. I think it should still go into melodic |
|
@bmagyar Yep, you're right. I also forgot that the joint limit logic requires |
|
#466 was merged, closing this |
|
Not sure if this is the right place to put this, but... I've literally just ran into this exact issue on a robot that I'm working with. Gazebo behaves nicely when using effort_controllers/JointTrajectoryController, but not so much when using effort_controllers/JointPositionController. In my URDF, I specify limits for the revolute joint in question as...
...but this causes the joint to rotate to pi right after the controllers are loaded and oscillate like mad around pi a few degrees. However, if I redefine the limits to...
...the problem goes away. My guess is that there is a tiny bit of overlap between ${-pi} and ${pi} that's causing this issue. Not sure how this should be addressed, but thought I'd point it out. I'm currently using Ubuntu 16.04 and ROS Kinetic. |
|
Not sure about the joint moving to PI in the very beginning, but I was indeed experiencing oscillations when limits were slightly overlapping. The changes proposed here and in #466 should fix the problem - though I think they have been merged only in the melodic branch, not kinetic... If you need a quick fix, perhaps the best is to clone the controllers locally and modify them manually to use |
Several joint position controllers use the angles::shortest_angular_distance_with_limits function for
REVOLUTEjoints to compute the position error, but this function only supports joint limits within the interval [-pi, pi].The angles::shortest_angular_distance_with_large_limits function supports limits outside the interval [-pi, pi], which I think is more suitable for this computation. A difference from the other API is that the lower limit is required to be smaller than the upper limit.
Closes #261.