romeo_wrapper.py
Go to the documentation of this file.
1 #
2 # Copyright (c) 2015-2016 CNRS
3 #
4 
5 import numpy as np
6 
7 from . import pinocchio_pywrap as pin
8 from .robot_wrapper import RobotWrapper
9 
10 
11 class RomeoWrapper(RobotWrapper):
12 
13  def __init__(self, filename, package_dirs=None, verbose=False):
14  self.initFromURDF(filename, package_dirs=package_dirs, root_joint=pin.JointModelFreeFlyer(), verbose=verbose)
15  self.q0 = np.array([
16  0, 0, 0.840252, 0, 0, 0, 1, # Free flyer
17  0, 0, -0.3490658, 0.6981317, -0.3490658, 0, # left leg
18  0, 0, -0.3490658, 0.6981317, -0.3490658, 0, # right leg
19  0, # chest
20  1.5, 0.6, -0.5, -1.05, -0.4, -0.3, -0.2, # left arm
21  0, 0, 0, 0, # head
22  1.5, -0.6, 0.5, 1.05, -0.4, -0.3, -0.2, # right arm
23  ])
24  if pin.getNumpyType()==np.matrix:
25  self.q0 = np.matrix(self.q0).T
26 
27  self.opCorrespondances = {"lh": "LWristPitch",
28  "rh": "RWristPitch",
29  "rf": "RAnkleRoll",
30  "lf": "LAnkleRoll",
31  }
32 
33  for op, name in self.opCorrespondances.items():
34  self.__dict__[op] = self.index(name)
35  # self.__dict__['_M'+op] = types.MethodType(lambda s, q: s.position(q,idx),self)
36 
37  # --- SHORTCUTS ---
38  def Mrh(self, q):
39  return self.position(q, self.rh)
40 
41  def Jrh(self, q):
42  return self.jacobian(q, self.rh)
43 
44  def wJrh(self, q):
45  return pin.jacobian(self.model, self.data, self.rh, q, False)
46 
47  def vrh(self, q, v):
48  return self.velocity(q, v, self.rh)
49 
50  def Jlh(self, q):
51  return self.jacobian(q, self.lh)
52 
53  def Mlh(self, q):
54  return self.position(q, self.lh)
55 
56  def Jlf(self, q):
57  return self.jacobian(q, self.lf)
58 
59  def Mlf(self, q):
60  return self.position(q, self.lf)
61 
62  def Jrf(self, q):
63  return self.jacobian(q, self.rf)
64 
65  def Mrf(self, q):
66  return self.position(q, self.rf)
67 
68 __all__ = ['RomeoWrapper']
def __init__(self, filename, package_dirs=None, verbose=False)


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