3/1

Dependencies:   mbed move4wheel2 EC CruizCore_R1370P

Files at this revision

API Documentation at this revision

Comitter:
la00noix
Date:
Fri Mar 01 08:00:53 2019 +0000
Parent:
3:8a0faa3b08c3
Commit message:
a

Changed in this revision

can/can.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
movement/movement.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/can/can.cpp	Fri Mar 01 00:48:07 2019 +0000
+++ b/can/can.cpp	Fri Mar 01 08:00:53 2019 +0000
@@ -30,20 +30,20 @@
             //debug_printf("[0]=%d [1]=%d [2]=%d [3]=%d [4]=%d [5]=%d\n\r",id1_value[0],id1_value[1],id1_value[2],id1_value[3],id1_value[4],id1_value[5]);
         }
 
-        /*if(msg.id == 3) {
+        if(msg.id == 3) {
             usw_data1 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
             //debug_printf("usw_data1 = %f\n\r",usw_data1);
-        }*/
+        }
 
-        /*   if(msg.id == 4){
+        if(msg.id == 4){
                usw_data2 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
                //debug_printf("usw_data2 = %f\n\r",usw_data2);
-           }*/
+           }
 
-        /*    if(msg.id == 5){
+            if(msg.id == 5){
                 usw_data3 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
                 //debug_printf("usw_data3 = %f\n\r",usw_data3);
-            }*/
+            }
 
         if(msg.id == 6) {
             usw_data4 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
--- a/main.cpp	Fri Mar 01 00:48:07 2019 +0000
+++ b/main.cpp	Fri Mar 01 08:00:53 2019 +0000
@@ -14,8 +14,6 @@
 //#define PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示する際に定義
 
 #define HARUROBO_TEST_MODE //テスト自動プログラム(練習・動作確認用)使用時に定義
-//#define HARUROBO_RIGHT_MODE //本番用自動プログラム(右側フィールド)使用時に定義
-//#define HARUROBO_LEFT_MODE //本番用自動プログラム(左側フィールド)使用時に定義
 
 int go_waitmode = 0;
 
@@ -56,17 +54,17 @@
            
            //can_start();
            //set_cond(2,1,-700,1,-700);
-           gogo_straight(1,1,-2962,3500,-2962,3000,200,1000,5,0.1,10,0.1,600,0);
-           purecurve(7,1,1,-2962,3000,-2317,2500,9,1000,5,0.1,10,0.1,600,0);
-           purecurve(8,1,1,-2317,2500,-1672,2000,9,1000,5,0.1,10,0.1,600,0);
-           gogo_straight(1,1,-1672,2000,-1672,1500,1000,200,5,0.1,10,0.1,600,0);
+           gogo_straight(1,1,-2962,3500,-2962,2900,200,1000,5,0.1,10,0.1,600,0);
+           purecurve(7,1,1,-2962,2900,-2317,2500,9,1000,5,0.1,10,0.1,600,0);
+           purecurve(8,1,1,-2317,2500,-1610,2000,9,1000,5,0.1,10,0.1,600,0);
+           gogo_straight(1,1,-1610,2000,-1610,1250,1000,200,5,0.1,10,0.1,600,0);
            MaxonControl(0,0,0,0);
-           set_cond(2,0,-1243,1,1076);
-           pos_correction(-1672,1500,0,0,1);
+           set_cond(2,0,-1243,1,1080);
+           pos_correction(-1610,1250,0,1,0);
            wait(0.5);
 
-           gogo_straight(1,1,-1672,1500,-1672,2000,200,1000,5,0.1,10,0.1,600,0);
-           purecurve(3,1,1,-1672,2000,-2317,2500,9,1000,5,0.1,10,0.1,600,0);
+           gogo_straight(1,1,-1610,1250,-1610,2000,200,1000,5,0.1,10,0.1,600,0);
+           purecurve(3,1,1,-1610,2000,-2317,2500,9,1000,5,0.1,10,0.1,600,0);
            purecurve(4,1,1,-2317,2500,-2962,3000,9,1000,5,0.1,10,0.1,600,-90);
            gogo_straight(1,1,-2962,3000,-2962,4000,1000,1000,5,0.1,10,0.1,600,-90);
            gogo_straight(1,1,-2962,4000,-2962,4500,1000,200,5,0.1,10,0.1,600,-90);
@@ -74,9 +72,9 @@
            pos_correction(-2962,4500,-90,1,1);
       
            set_cond(0,0,-2462,0,0);
-           gogo_straight(0,1,-2962,4500,-2850,4500,200,200,5,0.1,10,0.1,800,-90);
+           gogo_straight(1,1,-2962,4500,-2850,4500,200,200,5,0.1,10,0.1,800,-90);
            MaxonControl(0,0,0,0);
-           pos_correction(-2850,4500,-90,0,1);
+           pos_correction(-2850,4500,-90,1,1);
            wait(0.5);
       
            gogo_straight(1,1,-2850,4500,-2850,5150,200,1000,5,0.1,10,0.1,800,-90);
@@ -84,20 +82,20 @@
            purecurve(1,1,1,-2257,5500,-1700,6000,9,1000,5,0.1,10,0.1,800,-90);
            purecurve(3,1,1,-1700,6000,-2257,6647,9,1000,5,0.1,10,0.1,800,-90);
            gogo_straight(1,1,-2257,6647,-2500,6647,1000,1000,5,0.1,10,0.1,800,-90);
-           set_cond(1,0,0,0,7000);
-           gogo_straight(1,0,-2500,6647,-2700,6647,1000,200,5,0.1,10,0.1,800,-90);
+           set_cond(2,1,-3500,1,6324);
+           gogo_straight(1,1,-2500,6647,-2700,6647,1000,200,5,0.1,10,0.1,800,-90);
            MaxonControl(0,0,0,0);
-           pos_correction(-2700,6647,-90,1,0);
+           pos_correction(-2700,6647,-90,1,1);
            wait(0.5);
       
            gogo_straight(1,1,-2700,6647,-2500,6647,200,1000,5,0.1,10,0.1,800,-90);
-           gogo_straight(1,1,-2500,6647,-1243,6647,1000,1000,5,0.1,10,0.1,800,-90);
-           purecurve(8,1,1,-1243,6647,-519,6000,9,1000,5,0.1,10,0.1,600,-180);
-           gogo_straight(1,1,-519,6000,-519,4700,1000,1000,5,0.1,10,0.1,600,-180);
-           set_cond(2,0,0,1,4000);
-           gogo_straight(0,0,-519,4700,-519,4500,1000,200,5,0.1,10,0.1,800,-180);
+           gogo_straight(1,1,-2500,6647,-1000,6647,1000,1000,5,0.1,10,0.1,800,-90);
+           purecurve(8,1,1,-1000,6647,-350,6000,9,1000,5,0.1,10,0.1,600,-180);
+           gogo_straight(1,1,-350,6000,-350,4700,1000,1000,5,0.1,10,0.1,600,-180);
+           set_cond(2,1,1243,1,4000);
+           gogo_straight(1,1,-350,4700,-350,4500,1000,200,5,0.1,10,0.1,800,-180);
            MaxonControl(0,0,0,0);
-           pos_correction(-519,4500,180,0,0);
+           pos_correction(-400,4500,-180,1,1);
 
            go_waitmode = 1;
         
--- a/movement/movement.cpp	Fri Mar 01 00:48:07 2019 +0000
+++ b/movement/movement.cpp	Fri Mar 01 08:00:53 2019 +0000
@@ -61,8 +61,8 @@
     
     gyro.initialize();
     ec_ticker.attach(&calOmega,0.05);  //0.05秒間隔で角速度を計算
-    EC1.setDiameter_mm(48);
-    EC2.setDiameter_mm(48);  //測定輪半径//後で測定
+    EC1.setDiameter_mm(25.5);
+    EC2.setDiameter_mm(25.5);  //測定輪半径//後で測定
     info.nowX.enc = -2962; //初期位置の設定
     info.nowY.enc = 3500;
 }
@@ -447,7 +447,7 @@
     calc_xy(tgt_angle, u, v);
  
     while(1){  //機体の位置を目標領域(目標座標+許容誤差)に収める
-        gogo_straight(u,v,now_x,now_y,tgt_x,tgt_y,200,100,5,0.1,10,0.1,500,tgt_angle);
+        gogo_straight(u,v,now_x,now_y,tgt_x,tgt_y,200,50,5,0.1,10,0.1,500,tgt_angle);
         MaxonControl(0,0,0,0);
     
         calc_xy(tgt_angle, u, v);