From d9def00fab16ec6f543a78fd3b9ea8bd279e21ea Mon Sep 17 00:00:00 2001
From: mnaveau <maximilien.naveau@laas.fr>
Date: Wed, 12 Oct 2016 11:12:35 +0200
Subject: [PATCH] add test for going down 10cm height stairs and 15cm height
 stairs.

---
 tests/CMakeLists.txt       | 11 ++---
 tests/TestMorisawa2007.cpp | 87 ++++++++++++++++++++++++++++++--------
 2 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index bda7f670..a2c0be61 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -153,12 +153,13 @@ ENDMACRO(ADD_JRL_WALKGEN_EXE)
 
 # the following disabled test case are just useful code for offline
 # motion generation using the specialized inverse kinmatics of a robot
-ADD_JRL_WALKGEN_EXE(TestMorisawa2007ShortWalk TestMorisawa2007.cpp)
+#ADD_JRL_WALKGEN_EXE(TestMorisawa2007ShortWalk TestMorisawa2007.cpp)
 ADD_JRL_WALKGEN_EXE(TestMorisawa2007Climbing TestMorisawa2007.cpp)
-ADD_JRL_WALKGEN_EXE(TestMorisawa2007GoingDown TestMorisawa2007.cpp)
-ADD_JRL_WALKGEN_EXE(TestMorisawa2007SteppingStones TestMorisawa2007.cpp)
-ADD_JRL_WALKGEN_EXE(TestMorisawa2007WalkingOnBeam TestMorisawa2007.cpp)
-ADD_JRL_WALKGEN_EXE(TestMorisawa2007GoThroughWall TestMorisawa2007.cpp)
+ADD_JRL_WALKGEN_EXE(TestMorisawa2007GoingDown10 TestMorisawa2007.cpp)
+ADD_JRL_WALKGEN_EXE(TestMorisawa2007GoingDown15 TestMorisawa2007.cpp)
+#ADD_JRL_WALKGEN_EXE(TestMorisawa2007SteppingStones TestMorisawa2007.cpp)
+#ADD_JRL_WALKGEN_EXE(TestMorisawa2007WalkingOnBeam TestMorisawa2007.cpp)
+#ADD_JRL_WALKGEN_EXE(TestMorisawa2007GoThroughWall TestMorisawa2007.cpp)
 
 ####################
 ## Test Herdt 2010 #
diff --git a/tests/TestMorisawa2007.cpp b/tests/TestMorisawa2007.cpp
index 549438ef..acf61bc0 100644
--- a/tests/TestMorisawa2007.cpp
+++ b/tests/TestMorisawa2007.cpp
@@ -36,10 +36,11 @@ enum Profiles_t {
   PROFIL_ANALYTICAL_ONLINE_WALKING,          // 1
   PROFIL_ANALYTICAL_SHORT_STRAIGHT_WALKING,  // 2
   PROFIL_ANALYTICAL_CLIMBING_STAIRS,         // 3
-  PROFIL_ANALYTICAL_GOING_DOWN_STAIRS,       // 4
-  PROFIL_ANALYTICAL_STEPPING_STONES,         // 5
-  PROFIL_ANALYTICAL_WALKING_ON_BEAM,         // 6
-  PROFIL_ANALYTICAL_GO_THROUGH_WALL          // 7
+  PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_10,    // 4
+  PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_15,    // 5
+  PROFIL_ANALYTICAL_STEPPING_STONES,         // 6
+  PROFIL_ANALYTICAL_WALKING_ON_BEAM,         // 7
+  PROFIL_ANALYTICAL_GO_THROUGH_WALL          // 8
 };
 
 #define NBOFPREDEFONLINEFOOTSTEPS 11
@@ -204,7 +205,7 @@ protected:
 
   }
 
-  void AnalyticalGoingDownStairs(PatternGeneratorInterface &aPGI)
+  void AnalyticalGoingDownStairs15(PatternGeneratorInterface &aPGI)
   {
     CommonInitialization(aPGI);
     {
@@ -241,6 +242,47 @@ protected:
     }
   }
 
+  void AnalyticalGoingDownStairs10(PatternGeneratorInterface &aPGI)
+  {
+    CommonInitialization(aPGI);
+    {
+      istringstream strm2(":SetAlgoForZmpTrajectory Morisawa");
+      aPGI.ParseCmd(strm2);
+    }
+
+    {
+      istringstream strm2(":singlesupporttime 1.6");
+      aPGI.ParseCmd(strm2);
+    }
+
+    {
+      istringstream strm2(":doublesupporttime 0.2");
+      aPGI.ParseCmd(strm2);
+    }
+
+    {
+      istringstream strm2(":stepstairseq 0.0 -0.105 0.0 0.0\
+                          0.30 0.19 -0.10 0.0\
+                          0.0 -0.19 0.0 0.0\
+                          0.30 0.19 -0.10 0.0\
+                          0.0 -0.19 0.0 0.0\
+                          0.30 0.19 -0.10 0.0\
+                          0.0 -0.19 0.0 0.0\
+                          0.30 0.19 -0.10 0.0\
+                          0.0 -0.19 0.0 0.0\
+                          0.30 0.19 -0.10 0.0\
+                          0.0 -0.19 0.0 0.0\
+                          0.30 0.19 -0.10 0.0\
+                          0.0 -0.19 0.0 0.0\
+                          ");
+                          aPGI.ParseCmd(strm2);
+    }
+    {
+      istringstream strm2(":useDynamicFilter false");
+      aPGI.ParseCmd(strm2);
+    }
+  }
+
   void AnalyticalSteppingStones(PatternGeneratorInterface &aPGI)
   {
     CommonInitialization(aPGI);
@@ -453,8 +495,12 @@ protected:
         AnalyticalClimbingStairs(*m_PGI);
         break;
 
-      case PROFIL_ANALYTICAL_GOING_DOWN_STAIRS:
-        AnalyticalGoingDownStairs(*m_PGI);
+      case PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_10:
+        AnalyticalGoingDownStairs10(*m_PGI);
+        break;
+
+      case PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_15:
+        AnalyticalGoingDownStairs15(*m_PGI);
         break;
 
       case PROFIL_ANALYTICAL_STEPPING_STONES:
@@ -486,7 +532,9 @@ protected:
       return;
     if (m_TestProfile==PROFIL_ANALYTICAL_CLIMBING_STAIRS)
       return;
-    if (m_TestProfile==PROFIL_ANALYTICAL_GOING_DOWN_STAIRS)
+    if (m_TestProfile==PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_10)
+      return;
+    if (m_TestProfile==PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_15)
       return;
     if (m_TestProfile==PROFIL_ANALYTICAL_STEPPING_STONES)
       return;
@@ -576,10 +624,11 @@ int PerformTests(int argc, char *argv[])
   std::string CompleteName = string(argv[0]);
   unsigned found = CompleteName.find_last_of("/\\");
   std::string TestName =  CompleteName.substr(found+1);
-  int TestProfiles[7] = { PROFIL_ANALYTICAL_ONLINE_WALKING,
+  int TestProfiles[8] = { PROFIL_ANALYTICAL_ONLINE_WALKING,
                           PROFIL_ANALYTICAL_SHORT_STRAIGHT_WALKING,
                           PROFIL_ANALYTICAL_CLIMBING_STAIRS,
-                          PROFIL_ANALYTICAL_GOING_DOWN_STAIRS,
+                          PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_10,
+                          PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_15,
                           PROFIL_ANALYTICAL_STEPPING_STONES,
                           PROFIL_ANALYTICAL_WALKING_ON_BEAM,
                           PROFIL_ANALYTICAL_GO_THROUGH_WALL
@@ -587,19 +636,21 @@ int PerformTests(int argc, char *argv[])
   int indexProfile=-1;
 
   if (TestName.compare(16,6,"OnLine")==0)
-    indexProfile=0;
+    indexProfile=PROFIL_ANALYTICAL_ONLINE_WALKING;
   if (TestName.compare(16,9,"ShortWalk")==0)
-    indexProfile=1;
+    indexProfile=PROFIL_ANALYTICAL_SHORT_STRAIGHT_WALKING;
   if (TestName.compare(16,8,"Climbing")==0)
-    indexProfile=2;
-  if (TestName.compare(16,9,"GoingDown")==0)
-    indexProfile=3;
+    indexProfile=PROFIL_ANALYTICAL_CLIMBING_STAIRS;
+  if (TestName.compare(16,11,"GoingDown10")==0)
+    indexProfile=PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_10;
+  if (TestName.compare(16,11,"GoingDown15")==0)
+    indexProfile=PROFIL_ANALYTICAL_GOING_DOWN_STAIRS_15;
   if (TestName.compare(16,14,"SteppingStones")==0)
-    indexProfile=4;
+    indexProfile=PROFIL_ANALYTICAL_STEPPING_STONES;
   if (TestName.compare(16,13,"WalkingOnBeam")==0)
-    indexProfile=5;
+    indexProfile=PROFIL_ANALYTICAL_WALKING_ON_BEAM;
   if (TestName.compare(16,13,"GoThroughWall")==0)
-    indexProfile=6;
+    indexProfile=PROFIL_ANALYTICAL_GO_THROUGH_WALL;
 
 
   if (indexProfile==-1)
-- 
GitLab