Search code examples
drake

Modeling tool changer in Drake


My real world robot has a station where it can release its current end-effector and latch on to a new one. I would like to model this in Drake, maybe with a MultibodyPlant where there is a integer context variable that simply switches between tools. I would also be okay with having a LeafSystem contain MultibodyPlants inside (one for each tool), and I guess a context variable that multiplexes the scene graph output port to the correct MultibodyPlant. Is this a standard thing to do in Drake? If so, is there some easy example code I can adapt for this purpose? If not, what is the Drake way to model tool changer devices?


Solution

  • I suspect that the best workflow available today for simulation would be to use the ["joint locking"] feature (https://drake.mit.edu/doxygen_cxx/classdrake_1_1multibody_1_1_joint.html#a50c7f850050d4a94641ed72dd2d1968f). It would go something like this:

    • Add a joint (probably a quaternion floating joint) with your end effector as the parent and the tool as the child -- for all possible tools.
    • All joints start unlocked. The tools will effectively be floating bodies, except that their DOFs will be in coordinate relative to the end-effector.
    • When you move the end-effector to the changer, you lock the tool to the end-effector. Now they will move together as if welded.
    • Currently I believe you'll need to deal with the lock/unlock logic outside of the simulation... for instance you might have the simulation loop:
    while True:
       simulator.AdvanceTo(context.get_time() + 1.0)
       # maybe lock/unlock joints here
    

    We will have a slightly more flexible solution available soon using weld constraints in the contact solver.