Group of 3 hexapod legs

Dependents:   Hexapod_Library

Revision:
1:c6ba788a29a1
Parent:
0:22d279b8c2f1
Child:
2:81b3104caec1
--- a/Tripod.cpp	Mon May 02 16:20:36 2016 +0000
+++ b/Tripod.cpp	Mon May 02 16:33:37 2016 +0000
@@ -75,12 +75,8 @@
                 group_ticker.detach();
                 i = 0;
             }
-            
-            current_state_1 = next_state_1;
-            next_state_1++;
-            if (next_state_1 > 5) {
-                next_state_1 = 0;
-            }
+
+
 
 
         }
@@ -101,7 +97,7 @@
             leg_1.set_joint_angles(an_a_1, an_b_1, an_c_1);
             leg_2.set_joint_angles(an_a_2, an_b_2, an_c_2);
             leg_3.set_joint_angles(an_a_3, an_b_3, an_c_3);
-            
+
             j++;
 
             if (j > NUM_STEPS) {
@@ -109,11 +105,6 @@
                 j = 0;
             }
 
-            current_state_2 = next_state_2;
-            next_state_2++;
-            if (next_state_2 > 5) {
-                next_state_2 = 0;
-            }
 
 
 
@@ -140,5 +131,22 @@
 
 void Tripod::gait_smooth(void)
 {
-    group_ticker.attach(this, &Tripod::sweep_step_group, 0.1);
+
+
+    group_ticker.attach(this, &Tripod::sweep_step_group, 0.5);
+
+    if (group_number == 1) {
+        current_state_1 = next_state_1;
+        next_state_1++;
+        if (next_state_1 > 5) {
+            next_state_1 = 0;
+        }
+    } else if (group_number == 2) {
+        current_state_2 = next_state_2;
+        next_state_2++;
+        if (next_state_2 > 5) {
+            next_state_2 = 0;
+        }
+    }
+
 }
\ No newline at end of file