I'm attempting to simulate a joint that can be 'broken' when a wrench above some threshold is applied. Is there a simple way to do this?
I can see a hacky approach of using redundant links - one attached to the joint, one not, and then toggle visibility and collision of each when the 'break' should happen. But I'm wondering if there is an officially supported way.
The joint is currently modeled as a universal joint in an sdf file.
MultibodyPlant has support for constraints if you are running with the SAP solver (see MultibodyPlant::set_discrete_contact_solver
). The HardwareStation
in my manipulation course notes uses this by default.
See MultibodyPlant's AddBallConstraint
, AddCouplerConstraint
, AddDistanceConstraint
, and AddWeldConstraint
to decide how you want to model things. Then you can activate/deactivate the constraint using SetConstraintActiveStatus
.
Currently, you can only activate and deactivate constraints outside of the simulator, but you can do something like this:
while time < end_time:
time += 0.1
simulator.AdvanceTo(time)
if force is above your threshold:
plant.SetConstraintActiveStatus(...)