Hormone for optimizing COT

Dependents:   TurtleBot_v01 TurtleBot_with_AHS

Revision:
4:0dfa16b90d92
Parent:
3:91e508c05dca
--- a/hormone.cpp	Sun Nov 10 02:44:56 2019 +0000
+++ b/hormone.cpp	Wed Nov 20 06:50:25 2019 +0000
@@ -1,7 +1,10 @@
 #include "hormone.h"
 #include "mbed.h"
 
-#define HORMONE 0 // do you want to use hormone or not
+#define HORMONE 0       // do you want to use hormone (1) or not (0)
+
+// gait configuration when hormone is disable
+#define GAITCONFIG 0    // 0-default, 1-flat, 2-gravel, 3-pebble terrain
 
 /*------------------------< Function comment >------------------------*/ 
 /* NAME         : constructor                                         */ 
@@ -11,32 +14,35 @@
 /*--------------------------------------------------------------------*/ 
 hormone::hormone()
 {
-    // default config //
-    upDegree = 45.00; downDegree = 90.00; 
-    cgUp = 45.00; cgDown = 90.00;
-    cgUpPrev = 0.6; cgDownPrev = 0.7;
+    #if(GAITCONFIG == 0)
+        // default config //
+        upDegree = 45.00; downDegree = 90.00; 
+        cgUp = 45.00; cgDown = 90.00;
+        //cgUpPrev = 0.6; cgDownPrev = 0.7;
+    #endif
+    
+    #if(GAITCONFIG == 1)
+        // flat config //
+        upDegree = 45.00; downDegree = 95.00; 
+        cgUp = 45.00; cgDown = 95;
+        //cgUpPrev = 0.6; cgDownPrev = 0.5;
+    #endif
 
-/*
-    // flat config //
-    upDegree = 45.00; downDegree = 95.00; 
-    cgUp = 45.00; cgDown = 95;
-    cgUpPrev = 0.6;       
-    cgDownPrev = 0.5;
-*/
-/*   
-    // small config //
-    upDegree = 60.00; downDegree = 100.00; 
-    cgUp = 60.00; cgDown = 100;
-    cgUpPrev = 0.8;       
-    cgDownPrev = 0.3; 
-*/  
-/*
-    // big config //
-    upDegree = 75.00; downDegree = 90.00; 
-    cgUp = 75.00; cgDown = 90;
-    cgUpPrev = 1.0;       
-    cgDownPrev = 0.7; 
-*/
+    #if(GAITCONFIG == 2)
+        // small config //
+        upDegree = 60.00; downDegree = 100.00; 
+        cgUp = 60.00; cgDown = 100;
+        //cgUpPrev = 0.8; cgDownPrev = 0.3; 
+    #endif
+    
+    #if(GAITCONFIG == 3)
+        // big config //
+        upDegree = 75.00; downDegree = 90.00; 
+        cgUp = 75.00; cgDown = 90;
+        //cgUpPrev = 1.0; cgDownPrev = 0.7; 
+    #endif
+    
+    cgUpPrev = 0.0; cgDownPrev = 0.0;
     upPreProc = 0.0; downPreProc = 0.0;
 }
 
@@ -57,7 +63,17 @@
         
         return 75 * cgUp;
     #else
-        return 45.00f;
+        #if(GAITCONFIG == 0 || GAITCONFIG == 1 )
+            return 45.00f;
+        #endif
+        
+        #if(GAITCONFIG == 2)
+            return 60.00f;
+        #endif
+        
+        #if(GAITCONFIG == 3)
+            return 75.00f;
+        #endif
     #endif
 }
 
@@ -79,7 +95,17 @@
      
         return (-25.00f * cgDown) + 107.50f;
     #else
-        return 95.00f;
+        #if(GAITCONFIG == 0 || GAITCONFIG == 3 )
+            return 90.00f;
+        #endif
+        
+        #if(GAITCONFIG == 1)
+            return 95.00f;
+        #endif
+        
+        #if(GAITCONFIG == 2)
+            return 100.00f;
+        #endif
     #endif
 }