Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a torsional spring to rigid body plant in drake

Tags:

drake

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?

like image 774
Abdullah Nazir Avatar asked Sep 05 '25 03:09

Abdullah Nazir


1 Answers

The following helped. Thanks.

plant.AddForceElement(RevoluteSpring(plant.GetJointByName("elbow", model_instance_acrobot), nominal_angle, stiffness))
like image 101
Abdullah Nazir Avatar answered Sep 07 '25 22:09

Abdullah Nazir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!