RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.36k stars 1.27k forks source link

Deferred reification in `SceneGraph` #21380

Open SeanCurtis-TRI opened 7 months ago

SeanCurtis-TRI commented 7 months ago

Currently, as geometry gets registered with SceneGraph and roles get assigned, the geometry gets immediately reified in the various attendant engines. While there are historical reasons for why this is true, it is no longer necessarily true. And, certainly, when updating properties of registered geometry, this can lead to redundant work. The initial geometry gets reified, never practically used, and then gets replaced when its properties get updated.

It would be better to defer reification until the geometry is actually used.

Describe the solution you'd like Registration should not reify the geometry immediately. The geometry should be reified upon events which imply requirement:

Note: all functions that currently reify upon registration would need to continue this behavior when called on the model stored in a context. So, those acts would need to distinguish whether deferred reification is appropriate or not.

Describe alternatives you've considered There was an immediate pain point that triggered this idea. That was of reassigning roles with properties. The implementation of this functionality blindly eliminates the old reification and reifies again with the new properties, even if the new properties would produce the identical result. With this particular aspect of the problem, it could be resolved if the process of property changes were more sensitive to the nature of the changes and could recognize if reification were actually necessary.

jwnimmer-tri commented 4 months ago

Is there any benchmark (or really, just a simple sample program) we could use to measure the slow-down, and assess possible speed-ups?