Pydrake - Adding Revolute Joint to Plant

130 views Asked by At

I'm trying to add a revolute joint to my plant. Here is my code:

m_s_joint = RevoluteJoint(name="m_to_s_joint", frame_on_parent=frame_on_m,
                                       frame_on_child=frame_on_upper_c,
                                       axis=np.array([1., 0., 0.]),
                                       damping=0.0)
ma_su_joint = plant.AddJoint(m_s_joint)

When I print the joint:

print("joint: ", ma_su_joint)

I get:

joint:  <RevoluteJoint_[float] name='ma_to_su_joint' index=1 model_instance=1>

so it's clear the joint is being formed. But then I get this error:

    plant.Finalize()
RuntimeError: This multibody element does not belong to the supplied MultibodyTree.

Any ideas on why?

1

There are 1 answers

0
ricky On

I figured it out: The Revolute Joint calls a frame that I created but I never called AddFrame to register it to the plant. Doing that fixed the problem.