forward-dynamics-derivatives.py
Go to the documentation of this file.
1 import pinocchio as pin
2 import numpy as np
3 
4 
10 
11 # Create model and data
12 
13 model = pin.buildSampleModelHumanoidRandom()
14 data = model.createData()
15 
16 # Set bounds (by default they are undefinded for a the Simple Humanoid model)
17 
18 model.lowerPositionLimit = -np.ones((model.nq,1))
19 model.upperPositionLimit = np.ones((model.nq,1))
20 
21 q = pin.randomConfiguration(model) # joint configuration
22 v = np.matrix(np.random.rand(model.nv,1)) # joint velocity
23 tau = np.matrix(np.random.rand(model.nv,1)) # joint acceleration
24 
25 # Evaluate the derivatives
26 
27 pin.computeABADerivatives(model,data,q,v,tau)
28 
29 # Retrieve the derivatives in data
30 
31 ddq_dq = data.ddq_dq # Derivatives of the FD w.r.t. the joint config vector
32 ddq_dv = data.ddq_dv # Derivatives of the FD w.r.t. the joint velocity vector
33 ddq_dtau = data.Minv # Derivatives of the FD w.r.t. the joint acceleration vector


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:03