-
Notifications
You must be signed in to change notification settings - Fork 277
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
Physics: remove *VelocityCmd at each time step #2228
Conversation
Part of #1926. Signed-off-by: Steve Peters <[email protected]>
28bccb3
to
4070cac
Compare
Signed-off-by: Steve Peters <[email protected]>
Since JointVelocityCmd components are deleted after each timestep, don't skip updating forces and moments if the component does not exist, and use the SetComponent API to more cleanly handle the component creation logic. Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2228 +/- ##
==========================================
+ Coverage 65.66% 65.84% +0.18%
==========================================
Files 324 323 -1
Lines 30938 30669 -269
==========================================
- Hits 20315 20194 -121
+ Misses 10623 10475 -148 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Steve Peters <[email protected]>
cleaned up some code and improved coverage with |
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 good so far!
It would be good to characterize which systems are changing behavior due to this. For example, it looks like the DiffDrive system won't change behavior because it'll constantly be sending the last twist command it received.
{ | ||
_ecm.CreateComponent(this->dataPtr->jointEntity, | ||
components::JointVelocityCmd({0})); | ||
doUpdateForcesAndMoments = false; |
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 we need to preserve the doUpdateForcesAndMoments = false;
?
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.
no, the other places that variable is set to false is when a physics state / sensor reading component is unavailable that is needed for the control calculation, but JointVelocityCmd
is an actuator command written by this system, so it's ok if it's missing
the following systems reference a
The following systems are already modified by this pull request to use the
I still need to review the following two systems:
|
Signed-off-by: Steve Peters <[email protected]>
Now that the physics system is removing AngularVelocityCmd components at every timestep, that logic can be removed from the trajectory follower system. Signed-off-by: Steve Peters <[email protected]>
Upon further review, I found that the |
So not something that needs to be addressed here, but I believe that adding and removing components is relatively expensive (compared to setting/unsetting them) as they can incur allocation/deallocation as well as additional bookkeeping inside the ECM. I think in the future, we should consider having an |
That could make sense if it makes a significant performance improvement. We could define each component as |
I don't have a good gauge of the impact. I'm going to assume that not allocating/bookkeeping are always going to be better than allocation/bookkeeping. I think in this case, the trade-off would be a small amount of memory overhead, because you would be keeping the components in question (or a pointer to them).
That's basically what I'm suggesting. We may be able to do a little bit of syntactic sugar to make an |
as a followup on the performance side of things, the concept of "optional components" was mostly added already: #1334 (comment) So that is one less thing to worry about here. |
@scpeters what's the status of this PR? |
sorry I missed this notification until now. I thought it was good to go in November, but it may have gone out of date since then. I can open a separate pull request for the |
|
I merged these changes to |
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 good to me
Migration.md
Outdated
## Gazebo Sim 8.x to 9.0 | ||
|
||
* **Modified**: | ||
+ In the Physics system, all `*VelocityCmd` components are deleted after |
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.
mention that previously it was setting them to zero?
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.
Signed-off-by: Steve Peters <[email protected]>
@@ -5,6 +5,14 @@ Deprecated code produces compile-time warnings. These warning serve as | |||
notification to users that their code should be upgraded. The next major | |||
release will remove the deprecated code. | |||
|
|||
## Gazebo Sim 8.x to 9.0 | |||
|
|||
* **Modified**: |
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.
Thanks for adding this!
@@ -91,7 +91,7 @@ | |||
</geometry> | |||
</collision> | |||
<visual name="rotor_0_visual"> | |||
<pose>0 0 0 1.57 0 0 0</pose> | |||
<pose>0 0 0 1.57 0 0</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.
I realized last week while trying to fix another test that the quadcopter test is passing even though this SDF was invalid. I'll be making the same changes in other branches.
🎉 New feature
Part of #1926.
Summary
This implements the suggestion from #1926 (comment) to delete all
*VelocityCmd
components after each time step.Test it
I'm still figuring out how to test it.
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.