-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Joint Position Controller Behaviour Described in #1997 #2001
Conversation
This commit addresses #1997 There are several issues at play. First the target velcity calculation was wrong as described in #1997. Secondly, even if we corrected that there was still incorrect behaviour. This is due to the fact that we use the PID's CmdMax to determine what the maximum velocity for the joint is. However, in the event a user does not set a `<cmd_max>` this defaults to zero and the joint does not move. Finally this PR updates the tests. Previously our tests were only testing the case where the position command was well above the position's maximum velocity, hence it would slide into position. This PR introduces a test where we snap the position of the joint into place instead. Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Codecov Report
@@ Coverage Diff @@
## ign-gazebo6 #2001 +/- ##
===============================================
- Coverage 65.35% 65.34% -0.02%
===============================================
Files 327 327
Lines 27002 27086 +84
===============================================
+ Hits 17648 17698 +50
- Misses 9354 9388 +34
|
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
|
It still doesn't work for me, but based on the following I conclude there must also be another issue: What I did:
The object visual does not move in the GUI (for either of above messages).
So even though the object does not move in the GUI, the error is zero on each 2nd issue of an identical position command, i.e. the position must be reached, even though it is not reflected in the GUI. If you reduce the factor, e.g. Rather a bug in gz-rendering then?? |
I can reproduce your error with the example file attached. |
gz-sim/src/systems/physics/Physics.cc Line 2797 in c0a7428
|
OK figured it out this is really hairy (The changes in this PR are still necessary for the snap to functionality to work). The remaining problem is that the GUI goes out of sync when we don't regularly update a component marked as Seems like the pose updates get dropped because we use gz-sim/src/systems/physics/Physics.cc Line 2802 in c0a7428
Using OneTimeChange solves the issue where the GUI goes out of sync, however that is not a long term solution. Alternatively our ECS should keep track of which "changes exist but haven't been transmitted yet" (this seems better but harder). There are several options (in increasing order of difficulty):
I'm tempted to go with 2 or 3 as that seems the cleanest to me. However it might be worth considering 4 in some future release. |
@arjo129 Thank you so much for looking into this! The proposed changes are beyond my level of comprehension to provide relevant feedback I'm afraid... However, while digging through the code trying to understand it, I found following comments regarding what seems a similar issue: gz-sim/src/systems/scene_broadcaster/SceneBroadcaster.cc Lines 396 to 418 in c0a7428
So maybe something similar could be a solution? |
I haven't been able to fully test it yet, but it seems that this might also be a possible solution:
Not sure of possible drawbacks though... |
I was also able to reproduce this and I agree that it's an issue with GUI going out of sync with the server. The list of components that are marked |
@azeey Do I understand it correctly?
And:
This means e.g.:
Correct? |
Yes, I think we're on the same page. The only thing I'd say is that the |
Ill have a pr for this ready soon. |
This commit proposes a change to the scene broadcaster which enables tracking of all components with periodic changes. This way if a component has a periodic change the scene broadcaster does not miss it. For more info see this discussion #2001 (comment) where @azeey proposes this solution. This commit is WIP and I still need to handle entity/component removal and add tests. Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@azeey Given Anyway, I guess many ways lead to Rome... :-)
Is there some git wizzardry command to merge this diff into my local Gazebo Garden branch? I tried several fetch/merge/rebase combinations but I don't succeed. Yet there must be a better way than manual copy-paste... |
@jrutgeer I believe |
I agree this is not ideal, but we don't have a generalized mechanism to do this and as far as I know, only the SceneBroadcaster system suffers from this problem currently. Implementing the generalized mechanism would be a lot more complicated and probably not worth the effort right now. |
I didn't look into For reference: the procedure is:
To merge also #2010, another iteration is needed:
|
* Tracks periodic changes in scene broadcaster This commit proposes a change to the scene broadcaster which enables tracking of all components with periodic changes. This way if a component has a periodic change the scene broadcaster does not miss it. For more info see this discussion #2001 (comment) where @azeey proposes this solution. This commit is WIP and I still need to handle entity/component removal and add tests. Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> * Rework changes * Removes clone made of BaseComponent. Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> * More reworks of added APIs to ECM. Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> * Fix tests Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> * Add ECM related tests. Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> * Address spelling issue Co-authored-by: Michael Carroll <mjcarroll@intrinsic.ai> Signed-off-by: Arjo Chakravarty <arjo129@gmail.com> * Get rid of TODO Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> --------- Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai> Signed-off-by: Arjo Chakravarty <arjo129@gmail.com> Co-authored-by: Michael Carroll <mjcarroll@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. My main concern is with naming and documentation.
Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org> Signed-off-by: Arjo Chakravarty <arjo129@gmail.com>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@azeey I've addressed the renaming. The other issues highlighted have certain The SceneBroadcaster test seems flaky but I think it does not have much to do with this PR. |
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@osrf-jenkins run tests please |
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for iterating.
@ahcorde okay if I merge this? |
🦟 Bug fix
Fixes #1997
Summary
This commit addresses #1997
There are several issues at play. First the target velocity calculation was wrong as described in #1997. Secondly, even if we corrected that there was still incorrect behavior. This is due to the fact that we use the PID's CmdMax to determine what the maximum velocity for the joint is. However, in the event a user does not set a
<cmd_max>
this defaults to zero and the joint does not move. Finally this PR updates the tests. Previously our tests were only testing the case where the position command was well above the position's maximum velocity, hence it would slide into position. This PR introduces a test where we snap the position of the joint into place instead.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.