Closed siddancha closed 2 months ago
I agree that this is an issue. Good to have it on the queue, and happy to take contributions if you find it easier to resolve it.
I agree that this is an issue. Good to have it on the queue, and happy to take contributions if you find it easier to resolve it.
@RussTedrake Added PR #323 fixing this issue.
Current logic
When
add_frozen_child_instances=True
, the current logic in_PopulatePlantOrDiagram()
searches over a tree whose edges are defined only by weld directives to find child instances to add (see_FindChildren()
).[Permalink]:
Furthermore, only two types of directives are retained to be added to the controller plant --
add_model
andadd_weld
:[Permalink]:
The problem
This logic is problematic when the scenario file contains
add_frame
directives. For example, a common workflow is to add a custom frame relative to a body frame of one robot, and weld the custom frame to a body frame of another robot. In this case, the controller plant throws an error because it cannot find the declaration of the custom frame.Furthermore,
_FindChildren()
will not find children that are separated by at least oneadd_frame
directive.Proposed solution
We should treat
add_frame
directives as edges just likeadd_weld
in the search tree. This will detect any robot instance separated by a sequence ofadd_frame
andadd_weld
directives as a child.Secondly, we should add the relevant
add_frame
directives into the controller plant.Temporary workaround
I'm temporarily working around this issue by avoiding
add_frame
directives in my scenario file, and directly welding body frames instead.