Can you generate a scene graph after a plant has been finalized?

Viewed 22

I'm working on a project that requires me to add a model through Parser (which requires the plant to be of the same type as the array used) before Setting the position of the model in said plant and taking distance queries. These queries only work when the query object generated from the scene graph is of type float.

I've run into a problem where setting the position doesn't work due to the array being used being of type AutoDiff. A possible solution would then be converting the plant of type float to Autodiff with plant.ToAutoDiff(), but this only creates a copy of the plant without coupling it to the scene graph (and in turn the query object) from which the queries are derived. Taking queries with a query object generated from the original plant would then fail to reflect the new position passed to the AutoDiff copy.

Is there a way to create a new scene graph from the already finalized symbolic copy of the original plant, so that I can perform the queries with it?

1 Answers

A couple of thoughts:

  1. Don't just convert the plant to autodiff. Convert the whole diagram. That will give you a converted, connected network.
  2. You're stuck with the current workflow. Presumably, your proximity geometries are specified in your parsed file (as <collision> tags). The parsing process is ephemeral. The declaration is consumed, passed through MultibodyPlant into SceneGraph. If there is no SceneGraph at parse time, all knowledge of the declared collision geometry is forgotten.

So, the typical workflow is:

  • Create a float-valued diagram.
  • Scalar convert it to an AutoDiff-valued diagram.
  • Keep both around to serve the different roles.

We don't have a tutorial that directly shows scalar converting an entire diagram, but it's akin to what is shown in this MultibodyPlant-specific tutorial. Just call ToScalarType() on the Diagram root.

Related