From 1974fbbe381baccd7f6e98e1c333f45d7e178ca9 Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Thu, 10 Feb 2011 18:21:47 +0100
Subject: [PATCH] Split class Hrp2 into two classes Hrp2Laas and Hrp2Jrl.

---
 src/dynamic_graph/sot/dynamics/hrp2.py.in | 74 +++++++++++++++--------
 1 file changed, 49 insertions(+), 25 deletions(-)

diff --git a/src/dynamic_graph/sot/dynamics/hrp2.py.in b/src/dynamic_graph/sot/dynamics/hrp2.py.in
index 784d9c4..ddcb960 100755
--- a/src/dynamic_graph/sot/dynamics/hrp2.py.in
+++ b/src/dynamic_graph/sot/dynamics/hrp2.py.in
@@ -32,17 +32,37 @@ hrp2_14_pkgdatarootdir = "@HRP2_14_PKGDATAROOTDIR@"
 
 class Hrp2(AbstractHumanoidRobot):
     """
-    This class instanciates a simple humanoid robot with
+    This class instanciates a Hrp2 robot
     """
+    def smallToFull(self, config):
+        res = (config + 10*(0.,))
+        return res
+
+    def __init__(self, name, modelDir, xmlDir):
+        AbstractHumanoidRobot.__init__ (self, name)
+
+        modelName = 'HRP2JRLmainsmall.wrl'
+        specificitiesPath = xmlDir + '/HRP2SpecificitiesSmall.xml'
+        jointRankPath = xmlDir + '/HRP2LinkJointRankSmall.xml'
+
+        self.dynamic = DynamicHrp2(self.name + '.dynamics')
+        self.dynamic.setFiles(modelDir, modelName,
+                                   specificitiesPath, jointRankPath)
+        self.dynamic.parse()
+        self.dimension = self.dynamic.getDimension()
+        if self.dimension != len(self.halfSitting):
+            raise RunTimeError("invalid half-sitting pose")
+        self.initializeRobot()
 
+class Hrp2Jrl (Hrp2):
+    """
+    This class instanciates LAAS Hrp2 robot
+    """
     halfSitting = (
         # Free flyer
         0., 0., 0., 0., 0. , 0.,
 
         # Legs
-#        0., 0., -1.04720, 2.09440, -1.04720, 0.,
-#        0., 0., -1.04720, 2.09440, -1.04720, 0.,
-
         0., 0., -0.453786, 0.872665, -0.418879, 0.,
         0., 0., -0.453786, 0.872665, -0.418879, 0.,
 
@@ -50,32 +70,36 @@ class Hrp2(AbstractHumanoidRobot):
         0., 0., 0., 0.,
 
         # Arms
-#        0.17453, -0.17453, -0.17453, -0.87266, 0., 0., 0.1,
-#        0.17453,  0.17453,  0.17453, -0.87266, 0., 0., 0.1
+        0.261799, -0.17453, 0., -0.523599, 0., 0., 0.1, 0.261799
+        0.261799, 0.17453,  0., -0.523599, 0., 0., 0.1, 0.261799
+        )
 
+    def __init__(self, name,
+                 modelDir = hrp2_10_pkgdatarootdir,
+                 xmlDir = hrp2_10_pkgdatarootdir):
+        Hrp2.__init__(self, modelDir, xmlDir)
+    
+class Hrp2Laas (Hrp2):
+    """
+    This class instanciates LAAS Hrp2 robot
+    """
+    halfSitting = (
+        # Free flyer
+        0., 0., 0., 0., 0. , 0.,
+
+        # Legs
+        0., 0., -0.453786, 0.872665, -0.418879, 0.,
+        0., 0., -0.453786, 0.872665, -0.418879, 0.,
+
+        # Chest and head
+        0., 0., 0., 0.,
+
+        # Arms
         0.261799, -0.17453, 0., -0.523599, 0., 0., 0.1,
         0.261799, 0.17453,  0., -0.523599, 0., 0., 0.1,
         )
 
-    def smallToFull(self, config):
-        res = (config + 10*(0.,))
-        return res
-
     def __init__(self, name,
-                 simulation,
                  modelDir = hrp2_14_pkgdatarootdir,
                  xmlDir = hrp2_14_pkgdatarootdir):
-        AbstractHumanoidRobot.__init__ (self, name, simulation)
-
-        modelName = 'HRP2JRLmainsmall.wrl'
-        specificitiesPath = xmlDir + '/HRP2SpecificitiesSmall.xml'
-        jointRankPath = xmlDir + '/HRP2LinkJointRankSmall.xml'
-
-        self.dynamic = DynamicHrp2(self.name + '.dynamics')
-        self.dynamic.setFiles(modelDir, modelName,
-                                   specificitiesPath, jointRankPath)
-        self.dynamic.parse()
-        self.dimension = self.dynamic.getDimension()
-        if self.dimension != len(self.halfSitting):
-            raise "invalid half-sitting pose"
-        self.initializeRobot()
+        Hrp2.__init__(self, modelDir, xmlDir)
-- 
GitLab