Search code examples
pythondrake

pydrake: How do I aggregate multiple List[ExternallyAppliedSpatialForce] from distinct systems for a plant?


I am testing out some simple controllers, and would like to know how to aggregate List[ExternallyAppliedSpatialForce], specifically to provide to MultibodyPlant.get_applied_spatial_force_input_port().

If I try to connect both outputs to it, I get the following error:

RuntimeError: Input port is already wired.

For more context, I am looking at bilateral control, and want to eventually be able to study the effects of delays between the separate controllers. In this case, I am just trying out floating bodies as the "main" and "secondary" driven components.

An rough example of floating body controller:
https://gist.github.com/EricCousineau-TRI/f774b936aa930cf29777ed411815bbce#file-simple_floating_body_controller-py


Solution

  • The following PR has merged and provides ExternallyAppliedSpatialForceMultiplexer:
    drake#18171