Search code examples
drake

Fixing certain positions in a MultiBodyPlant in Drake


I have a MultibodyPlant containing a 6-dof robot, and a stationary 2-dof obstacle. The plant's positions vector is 8-dimensional [object_x_offset, object_y_offset, robot_joint_1, ..., robot_joint_6].

This is very convenient for something like IrisInConfigurationSpace where I can now generate collision free regions around an obstacle, whose pose I can leave undetermined until runtime. When I localize the obstacle, I can simply take each 8-dimensional convex region down 6-dimensions by slicing it at the known [object_x, object_y] coordinates.

However, this is inconvenient for using Drake's trajectory planning algorithms, which will assume that the [object_x, object_y] coordinates can be controlled. I find myself manually adding linear constraints into the MathematicalProgram to fix these coordinates.

Instead, I would like a way to create a related MultibodyPlant, whose .num_positions() == 6 that calls down to my original plant with the first two coordinates fixed to some numbers of my choosing.

Is there an easy way to do this?


Solution

  • We've had discussions for a long time about adding more substantial "remodeling" capabilities to MultibodyPlant. See this issue, for some reading.

    But the workflow I would recommend today would be to parse the model twice -- once including the manipuland (for IRIS, etc), and a second time for just the trajopt. That's a common workflow for control, too... for instance, the ManipulationStation examples work this way.

    In my view, it is very reasonable to have multiple models of the world... the physics engine has one model and the robot controller / planner has a different model. I do think it would be more ergonomic to be able to remodel existing MultibodyPlants, but don't think it's too hard to just load each one separately through the parser.