-
Notifications
You must be signed in to change notification settings - Fork 506
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
Add simulator physics collision cache. #2080
base: main
Are you sure you want to change the base?
Conversation
@@ -696,6 +700,16 @@ def get_observations_at( | |||
else: | |||
return None | |||
|
|||
def get_physics_contact_points(self) -> List[ContactPointData]: | |||
sim_time = self.get_world_time() | |||
contact_points_dirty = sim_time != self._contact_point_cache_time |
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.
Let's add this as a member variable and set it to dirty on reset/reconfigure also. Those events will both reset time and change the scene state.
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.
My other concern here is that moving objects will invalidate the cache and any calls to Simulator.perform_discrete_collision_detection will be missed.
Perhaps you want to override that function also to modify the dirty flag.
I think at that point the likelihood of erroneous contact point data should be minimized.
No, the role of this function is to run the collision detection procedure one time to update the internal caches which we query when calling the contact point getter. No physics are done by that function, so world time shouldn't change. |
7d6c734
to
83651fa
Compare
Motivation and Context
This adds a cache for the
habitat-sim
get_physics_contact_points()
function.This function is called multiple times a frame and is quite expensive.
On a reference single-learn HITL application, this improves the framerate from
11.3
to13.8
FPS.How Has This Been Tested
Tested locally + unit tests.
Types of changes
Checklist