Solving issues with large rotational limits#466
Solving issues with large rotational limits#466bmagyar merged 13 commits intoros-controls:melodic-develfrom
Conversation
bmagyar
left a comment
There was a problem hiding this comment.
The changes look good to me on first read. Could you please add a test that fails without these changes? Could reuse the same code for all controllers.
|
Glad to! However, how should I proceed? The issue can be seen "visually" without much problems, however I am not so sure about what strategy to follow to analyze it in a test - I believe you want a test that can be checked by continuous integration, isn't it? I think the easier way to spot the problem in the code is to check the return value of |
matthew-reynolds
left a comment
There was a problem hiding this comment.
Looks good to me, I agree that tests would be great. Perhaps we could check the sign of the commanded vel/effort for a specific set of limits and current position to see if it is using the correct limits? I don't know what angle shortest_angular_distance_with_limits returns if the limits are violated, so maybe this wouldn't work.
|
Ping |
|
Sorry for being inactive for such a long time. I removed the check |
|
I added a simple test for If you start RViz, set the fixed frame as Is this good enough? The test is quite simple, but I could not think of any better solution... If you think it is ok, I can then add a similar test also for Note: the test is failing during the CI due to the timeout. Since on my PC it was working well, I think it might be due to a lower processing power of the hosting virtual machine (?). I will try to solve the issue by increasing both the control period (it is currently 1ms) and the timeout. Sorry if this adds unnecessary commits... |
|
I was finally able to make the tests succeed. Again, I apologize for the long commit list... I can rebase and squash all test-related commits into one, let me know! |
|
Thanks for the approval! Before merging, do you want me to rebase the commit history and/or add the same test also for |
matthew-reynolds
left a comment
There was a problem hiding this comment.
This looks great, thanks! I think we just need to touch up the CMakeLists & package.xml to get the dependencies sorted out, and then I have a handful of small requests.
Can you confirm that these tests fail with the old angles::shortest_angular_distance_with_limits?
bmagyar
left a comment
There was a problem hiding this comment.
I'm happy with these, can merge as soon as @matthew-reynolds is happy too :)
|
@matthew-reynolds I addressed your comments, let me know if anything needs to be updated 😃
Yes, if I change the Update: I uploaded two videos, showing the difference between the proposed changes and the old behavior. |
|
Just found a stupid mistake in the |
matthew-reynolds
left a comment
There was a problem hiding this comment.
Awesome, thanks for the videos, this is great.
I'm good as soon as @bmagyar gives the license a peek, and once we swap to EXPECT.
|
I updated the code according to the last comments. I think all points from your reviews have been addressed, but let me know if I forgot something instead! |
|
Thanks very much for sticking with us through this review! Merging... |
As found out by others as well, there is a small issue in some controllers when a revolute joints has "large" limits, see eg #365
The problem is that some position controllers call the function
angles::shortest_angular_distance_with_limits, which assumes that the total allowed range of rotation is lower than2*PI. Therefore, if one has as limits such as[-PI-eps, PI+eps),angleswill assume that the valid range has size2*epsinstead of2*(PI+eps). To allow dealing with larger rotations, the PR ros/angles#16 introduced the functionshortest_angular_distance_with_large_limits.I updated three controllers to use such function in case
upper_limit-lower_limitis greater than or equal to2*PI. I tested it and the oscillations that could be experienced before now disappear.