-
Notifications
You must be signed in to change notification settings - Fork 41
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
write modified link data to output in physics step #223
Conversation
Codecov Report
@@ Coverage Diff @@
## main #223 +/- ##
==========================================
+ Coverage 82.85% 83.00% +0.14%
==========================================
Files 107 107
Lines 4119 4159 +40
==========================================
+ Hits 3413 3452 +39
- Misses 706 707 +1
Continue to review full report at Codecov.
|
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.
@azeey the implementation is working, but I have a few questions. Would you mind taking a look at the code and addressing my comments below?
a9b33c9
to
f80f687
Compare
f80f687
to
e4dea17
Compare
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
e4dea17
to
f2febb1
Compare
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
This is now ready for review. I have updated this PR to target Edifice ( We'll need to make a minor release for |
dartsim/src/SimulationFeatures.cc
Outdated
_poses.entries.push_back(wp); | ||
} | ||
|
||
prevLinkPoses[id] = wp.pose; |
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.
do you need to keep this map up-to-date when links are removed?
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.
Yeah, thanks for catching this. I believe I have handled this in 84b9f4e. Let me know what you think.
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
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! I left some minor comments.
dartsim/src/SimulationFeatures.cc
Outdated
_poses.entries.push_back(wp); | ||
} | ||
|
||
newPoses[id] = wp.pose; |
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.
Should this be inside the if
block since it's supposed to be collecting new poses?
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.
The reason why I left this outside of the if
block is because of floating point precision. My thought was that I should save the most recent pose in newPoses
no matter what each time, since there's a small tolerance (1e-6
) in the pose equality check. Since newPoses
is used as prevLinkPoses
the next time around, this ensures that we are comparing the newest link pose to the actual previous pose, instead of to a pose that is very close to the previous pose. Does that make sense? If you think that leaving this outside of the if
block is okay, I can add a comment there that mentions what I just described to you. Otherwise, I can move this to be inside of the if
block.
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.
I would think you'd want to compare it to the last pose sent to the user though because you want to err on the side of sending too much to the user (eg. ign-gazebo). Consider, for example, if each successive time the pose changes by +1e-7, since you always compare against the previous actual pose, it will always look like there no new pose to send to the user. Over time, this could cause a significant amount of drift.
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.
You're definitely correct. I believe that this should now be fixed in 494f6c5
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
Signed-off-by: Ashton Larkin <ashton@openrobotics.org>
All review feedback has been addressed, so I am opening this for another round of review. |
@osrf-jenkins run tests please |
Signed-off-by: Ashton Larkin ashton@openrobotics.org
🎉 New feature
Requires gazebosim/gz-math#196
Possible solution for #219
Summary
As mentioned in #219, downstream libraries that use
ign-physics
(likeign-gazebo
) don't have a way of knowing which links moved in the most recent physics step. This PR takes advantage of a forward step'soutput
by writing changed link poses to the output. The output can then be used by downstream libraries to only operate on modified links (take a look at gazebosim/gz-sim#678 for an example).Test it
Take a look at the tests added in this PR (files changed tab ->
tpe/plugin/src/SimulationFeatures_TEST.cc
ordartsim/src/SimulationFeatures_TEST.cc
) to see how the modified pose data can be accessed fromignition::physics::ForwardStep::Output
.To get an understanding of how this change can be used/tested in downstream libraries, take a look at gazebosim/gz-sim#678.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge