Changing weld joint pose

Viewed 68

I've constructed an MBP with two objects, A (welded to world) and B (unwelded). B sits on top of A. After simulating for a while, I'd like to remove A (or otherwise disable contact) to allow B to begin falling.

It seems I should be able to do this by either (1) changing collision filtering on the fly or by (2) changing the pose of the weld joint. Haven't investigated (1), but (2) seems to be out- there does not appear to be a way to alter the pose of a weld after construction. True? If true, why not?

3 Answers

Currently you can achieve this by making one of the frames of the weld joint a FixedOffsetFrame and modifying the parameters of that. Here's a snippet with an example:

// Weld body B to body A and move body B.

// Original transform for the weld between body_A and body_B
math::RigidTransform<double> X_AB(...);

const FixedOffsetFrame<double>& frame_on_A = plant->AddFrame(
    std::make_unique<FixedOffsetFrame<double>>(body_A.body_frame(), X_AB));

plant->WeldFrames(frame_on_A, body_B.body_frame());

// ... create a context and simulate ...

// New transform for the weld between body_A and body_B
math::RigidTransform<double> X_AB_new(...)

frame_on_A.SetPoseInBodyFrame(context, X_AB_new);

I'll work on #13520 to make this more convenient by changing a parameter on the weld joint itself.

We do not have the capability to modify a weld joint pose yet. See issue #13520.

Related