RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.19k stars 1.24k forks source link

Getters for MultibodyConstraintId for constraints added by the Parser #21482

Closed RussTedrake closed 1 month ago

RussTedrake commented 1 month ago

Is your feature request related to a problem? Please describe.

21397 added MultibodyPlant::RemoveJoint, but throws if there are any constraints registered with the plant. We have MultibodyPlant::RemoveConstraint(MultibodyConstraintId), but if constraints are added by the Parser, then there is no way from python to get the MultibodyConstraintId.

Describe the solution you'd like The minimal API which would unblock this issue is to add std::vector<MultibodyConstraintId> MultibodyPlant::GetConstraintIds().

Describe alternatives you've considered The existing accessor methods, like get_coupler_constraint_specs, could serve this purpose, but they are currently marked as internal and are not bound in pydrake. We could change this decision. Even if we implement GetConstraintIds(), we don't currently have any pydrake methods to introspect even what type of constraint is associated with the MultibodyConstraintId.

We could add MultibodyPlant::RemoveAllConstraints().

cc @amcastro-tri , @joemasterjohn