inverse-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.random.rand(model.nv, 1) # joint velocity
23 a = np.random.rand(model.nv, 1) # joint acceleration
24 
25 # Evaluate the derivatives
26 
27 pin.computeRNEADerivatives(model, data, q, v, a)
28 
29 # Retrieve the derivatives in data
30 
31 dtau_dq = data.dtau_dq # Derivatives of the ID w.r.t. the joint config vector
32 dtau_dv = data.dtau_dv # Derivatives of the ID w.r.t. the joint velocity vector
33 dtau_da = data.M # Derivatives of the ID w.r.t. the joint acceleration vector


pinocchio
Author(s):
autogenerated on Sat Jun 1 2024 02:40:35