2

It seems that we have to plug the numeric values into context and get the corresponding equation of motion. Is it possible to plug in symbolic values and get EoM with e.g., q1, q2?

context = plant.CreateDefaultContext()
plant.SetPositions(context, q)
if v is not None:
    plant.SetVelocities(context, v)
M = plant.CalcMassMatrixViaInverseDynamics(context)
Cv = plant.CalcBiasTerm(context)
tauG = plant.CalcGravityGeneralizedForces(context)
B = plant.MakeActuationMatrix()
return (M, Cv, tauG, B)
Shinnnn
  • 99
  • 5

1 Answers1

4

Yes! (not many robot simulators can do that!) See the last cell of this example: https://github.com/RussTedrake/underactuated/tree/7faf2721c248e889464fe024a65982a43dd78aff/examples/double_pendulum/dynamics.ipynb which calls the method here: https://github.com/RussTedrake/underactuated/blob/7faf2721c248e889464fe024a65982a43dd78aff/underactuated/multibody.py

Caveat: it won't work through collisions/contact yet.

Russ Tedrake
  • 4,703
  • 1
  • 7
  • 10