ROBOSTEP_5期 / Mbed 2 deprecated George_Master_Param

Dependencies:   mbed robot

Files at this revision

API Documentation at this revision

Comitter:
shimizuta
Date:
Mon May 27 04:50:42 2019 +0000
Parent:
57:30cd20c654d1
Commit message:
NHK finish

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
moves/moves.cpp Show annotated file Show diff for this revision Revisions of this file
moves/moves.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat May 25 04:50:48 2019 +0000
+++ b/main.cpp	Mon May 27 04:50:42 2019 +0000
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 
 
-#define BADRULEMODE
+//#define BADRULEMODE
 
 void StateFlow(int i);
 void SetMode();
@@ -147,9 +147,13 @@
             motor_li.setDutyLimit(params[4].duty);
             if(RightOrLeft == 0) phasing(params[4].argument[0]);
             else phasing(-params[4].argument[0]);
+            
             motor_lo.setDutyLimit(params[5].duty);
             motor_li.setDutyLimit(params[5].duty);
-            for(int i= 0; i<(int)params[5].condition; ++i) straight();
+            for(int i= 0; i<(int)params[5].condition; ++i){
+                 straight();
+                 wait(0.05);//速度落とし用
+            }
             
             motor_lo.setDutyLimit(params[6].duty);
             motor_li.setDutyLimit(params[6].duty);
@@ -241,6 +245,7 @@
             }
             hand_mode = GOAL;
             stop();
+            ResetRun();
             printf("uhai!!!!!!!!!!!!!!!/r/n");
     }
 }
--- a/moves/moves.cpp	Sat May 25 04:50:48 2019 +0000
+++ b/moves/moves.cpp	Mon May 27 04:50:42 2019 +0000
@@ -19,10 +19,29 @@
     BACK,
     STOP,
     FORWARD,
+    RESET,
 };
 int step_num_l, step_num_r;
 void WaitAnotherLeg();
 
+void ResetRun()
+{
+    int target_step = step_num_l;
+    leg_lo.setTargetPose(180 + target_step*180);
+    leg_li.setTargetPose(180 + target_step*180);
+    can_send(RESET, motor_lo.getDutyLimit());
+    led1 = 1;
+    robot.run();
+    led1 = 0;
+    motor_lo_f.write(0);
+    motor_lo_b.write(0);
+    motor_li_f.write(0);
+    motor_li_b.write(0);
+    FileWrite();
+}
+
+
+
 //収束していなければLED1をON. param:: d_step_l:左足を動かす歩数。負なら後ろに進む
 void Run(WalkMode mode, int d_step_l)
 {
@@ -98,6 +117,7 @@
     if(lope_count >= max_count) {
 //        mode = STRAIGHT;
         is_turn = 1;
+        lope_count=0;
     }
     switch(mode) {
         case STRAIGHT:
--- a/moves/moves.h	Sat May 25 04:50:48 2019 +0000
+++ b/moves/moves.h	Mon May 27 04:50:42 2019 +0000
@@ -17,4 +17,5 @@
 void lopeAndInfinity(float target_degree, float tolerance_degree);
 void climbAndInfinity(float target_degree, float tolerance_integral);
 void HandMove();
+void ResetRun();
 #endif
\ No newline at end of file