RussTedrake / manipulation

Course notes for MIT manipulation class
BSD 3-Clause "New" or "Revised" License
407 stars 119 forks source link

Multiple instantiations of `MultiBodyPlant` and `iiwa`. #232

Closed kamiradi closed 1 year ago

kamiradi commented 1 year ago

I am having trouble understanding why the iiwa model is being loaded here again. Wasn't the iiwa robot being loaded via the the model directives in the function here?

What was the reason you have maintained two different plants for the main system and the controller when setting up the manipulation station? Couldn't we add all the elements to the same instance of the Multibody plant? Am I missing something here?

Thank you for your work and instruction, it has been very helpful.

RussTedrake commented 1 year ago

Having two different models is the most common workflow, and I think appropriate. The first model (called plant) is the model used by the physics engine; it includes both the robot and the objects in the world. The second model (called here controller_plant) is the robot's "internal model" used for control; it only includes the robot itself (and in fact has a welded version of the gripper). This corresponds to the model that the iiwa control station has in its software stack; which really does have only the dynamics of the arm + a rigid "tool" inertia.

kamiradi commented 1 year ago

Ah I see, I misunderstood the plant to be the physics engine. Does this mean that if you load n robots into the scene, your code needs to always have n+1 instantiations of MultiBodyPlant - in the case of maintaining a controller for each robot?

RussTedrake commented 1 year ago

In this code, the plant is the physics engine, and the controller_plant is the internal model. You can model all sorts of combinations of things, but yes, I would say if you have n robots that all have their own internal models, then you would likely end up with n+1 plants.