bindings_frame_derivatives.py
Go to the documentation of this file.
1 import unittest
2 import pinocchio as pin
3 import numpy as np
4 
5 from test_case import PinocchioTestCase
6 
8 
9  def setUp(self):
10  self.model = pin.buildSampleModelHumanoidRandom()
11  self.parent_idx = self.model.getJointId("rarm2_joint") if self.model.existJointName("rarm2_joint") else (self.model.njoints-1)
12  self.frame_name = self.model.names[self.parent_idx] + "_frame"
13  self.frame_placement = pin.SE3.Random()
14  self.frame_type = pin.FrameType.OP_FRAME
15  self.model.addFrame(pin.Frame(self.frame_name, self.parent_idx, 0, self.frame_placement, self.frame_type))
16  self.frame_idx = self.model.getFrameId(self.frame_name)
17 
18  self.data = self.model.createData()
19  self.q = pin.randomConfiguration(self.model)
20  self.v = np.random.rand((self.model.nv))
21  self.a = np.random.rand((self.model.nv))
22 
23  def tearDown(self):
24  del self.model
25 
26  def test_derivatives(self):
27  model = self.model
28  data = self.data
29 
30  q = self.q
31  v = self.v
32  a = self.a
33 
34  pin.computeForwardKinematicsDerivatives(model,data,q,v,a)
35 
36  pin.getFrameVelocityDerivatives(model,data,self.frame_idx,pin.WORLD)
37  pin.getFrameVelocityDerivatives(model,data,self.frame_idx,pin.LOCAL)
38  pin.getFrameVelocityDerivatives(model,data,self.frame_idx,pin.LOCAL_WORLD_ALIGNED)
39 
40  pin.getFrameAccelerationDerivatives(model,data,self.frame_idx,pin.WORLD)
41  pin.getFrameAccelerationDerivatives(model,data,self.frame_idx,pin.LOCAL)
42  pin.getFrameAccelerationDerivatives(model,data,self.frame_idx,pin.LOCAL_WORLD_ALIGNED)
43 
44 if __name__ == '__main__':
45  unittest.main()


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