bindings_kinematics_derivatives.py
Go to the documentation of this file.
1 import unittest
2 
3 import numpy as np
4 import pinocchio as pin
5 from test_case import PinocchioTestCase
6 
7 
9  def setUp(self):
10  self.model = pin.buildSampleModelHumanoidRandom()
11  self.joint_idx = (
12  self.model.getJointId("rarm2_joint")
13  if self.model.existJointName("rarm2_joint")
14  else (self.model.njoints - 1)
15  )
16 
17  self.data = self.model.createData()
18  self.q = pin.randomConfiguration(self.model)
19  self.v = np.random.rand(self.model.nv)
20  self.a = np.random.rand(self.model.nv)
21 
22  def tearDown(self):
23  del self.model
24 
25  def test_derivatives(self):
26  model = self.model
27  data = self.data
28 
29  q = self.q
30  v = self.v
31  a = self.a
32 
33  pin.computeForwardKinematicsDerivatives(model, data, q, v, a)
34 
35  pin.getJointVelocityDerivatives(model, data, self.joint_idx, pin.WORLD)
36  pin.getJointVelocityDerivatives(model, data, self.joint_idx, pin.LOCAL)
37  pin.getJointVelocityDerivatives(
38  model, data, self.joint_idx, pin.LOCAL_WORLD_ALIGNED
39  )
40 
41  pin.getJointAccelerationDerivatives(model, data, self.joint_idx, pin.WORLD)
42  pin.getJointAccelerationDerivatives(model, data, self.joint_idx, pin.LOCAL)
43  pin.getJointAccelerationDerivatives(
44  model, data, self.joint_idx, pin.LOCAL_WORLD_ALIGNED
45  )
46 
47 
48 if __name__ == "__main__":
49  unittest.main()
bindings_kinematics_derivatives.TestFrameBindings.q
q
Definition: bindings_kinematics_derivatives.py:18
bindings_kinematics_derivatives.TestFrameBindings
Definition: bindings_kinematics_derivatives.py:8
bindings_kinematics_derivatives.TestFrameBindings.v
v
Definition: bindings_kinematics_derivatives.py:19
bindings_kinematics_derivatives.TestFrameBindings.test_derivatives
def test_derivatives(self)
Definition: bindings_kinematics_derivatives.py:25
pinocchio::createData
ConstraintDataTpl< Scalar, Options, ConstraintCollectionTpl > createData(const ConstraintModelTpl< Scalar, Options, ConstraintCollectionTpl > &cmodel)
Definition: constraint-model-visitor.hpp:239
bindings_kinematics_derivatives.TestFrameBindings.a
a
Definition: bindings_kinematics_derivatives.py:20
bindings_kinematics_derivatives.TestFrameBindings.data
data
Definition: bindings_kinematics_derivatives.py:17
bindings_kinematics_derivatives.TestFrameBindings.model
model
Definition: bindings_kinematics_derivatives.py:10
bindings_kinematics_derivatives.TestFrameBindings.joint_idx
joint_idx
Definition: bindings_kinematics_derivatives.py:11
test_case.PinocchioTestCase
Definition: test_case.py:11
bindings_kinematics_derivatives.TestFrameBindings.setUp
def setUp(self)
Definition: bindings_kinematics_derivatives.py:9
bindings_kinematics_derivatives.TestFrameBindings.tearDown
def tearDown(self)
Definition: bindings_kinematics_derivatives.py:22


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:06