4

I'm new to using drake and trying to add a torsional spring through pydrake to an acrobot model imported from urdf. The relevant portion of the code looks like this

builder = DiagramBuilder()
plant, scene_graph = AddMultibodyPlantSceneGraph(builder, 0.0)

parser = Parser(plant)
model_instance_acrobot = parser.AddModelFromFile("...acrobot.urdf")

RevoluteSpring(plant.GetJointByName("elbow", model_instance_acrobot), nominal_angle, stiffness)

plant.Finalize()

But it can't seem to simulate the effect of spring. Is there any command I'm missing to add the effect of spring to the multibody plant?

1 Answers1

4

The following helped. Thanks.

plant.AddForceElement(RevoluteSpring(plant.GetJointByName("elbow", model_instance_acrobot), nominal_angle, stiffness))