MEC-B / Mbed 2 deprecated AR_MastarNode_copy

Dependencies:   DriveConroller IMU MDD Mycan Odometer PID RotaryEncoder UART USS mbed

Fork of AR_MastarNode by MEC-B

Files at this revision

API Documentation at this revision

Comitter:
TanakaTarou
Date:
Sun Nov 11 08:13:37 2018 +0000
Parent:
31:23ed34fa842f
Commit message:
11/11 ????10???

Changed in this revision

hardwareConfig.h 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
stateLib.h Show annotated file Show diff for this revision Revisions of this file
--- a/hardwareConfig.h	Thu Nov 08 14:58:20 2018 +0000
+++ b/hardwareConfig.h	Sun Nov 11 08:13:37 2018 +0000
@@ -19,7 +19,7 @@
                        };
                        
 //(逆運動学モデル, ホイールの計算100%定義)
-DriveController mecanum(jacobian, 0.6);
+DriveController mecanum(jacobian, 0.8);
 
 //sbus用 (tx, rx)
 SBUS sbus(p28, p27);
--- a/main.cpp	Thu Nov 08 14:58:20 2018 +0000
+++ b/main.cpp	Sun Nov 11 08:13:37 2018 +0000
@@ -12,8 +12,8 @@
 #include "hardwareConfig.h"
 #include "stateLib.h"
 
-#define PIDMAX_X 0.45
-#define PIDMAX_Y 0.5
+#define PIDMAX_X 0.60
+#define PIDMAX_Y 0.70
 /*
 #define RETURN_X 0.45
 #define RETURN_Y 0.5
@@ -32,7 +32,7 @@
 void fenceUss();
 
 //x軸補正用 PID
-PID pidRobotX(4, 0, 0, 0.01, PIDMAX_X, &timer);
+PID pidRobotX(3, 0, 0, 0.01, PIDMAX_X, &timer);
 float target_x = 0;
 
 //y軸補正用 PID
@@ -40,11 +40,11 @@
 float target_y = 0;
 
 //yow角補正用 (Pgain, Igain, Dgain, 制御ループ時間[s], 計算出力100%定義)
-PID pidRobotYow(0.05, 0, 0, 0.01, 0.3, &timer);
+PID pidRobotYow(0.10, 0, 0, 0.01, 0.5, &timer);
 float target_yow = 0;
 
 //USS用
-PID pidUss(0.025, 0, 0, 0.1, 0.5, &timer);
+PID pidUss(0.025, 0, 0, 0.1, 0.7, &timer);
 float target_uss = 0;
 
 //オドメーターの定義
@@ -52,7 +52,7 @@
                       {0, 1, 0},
                       {0, 0, 0}
                      };
-Odometer odm(matrix, 0.050);
+Odometer odm(matrix, 0.0508);
 
 int table_sw[13];
 int now_num;
@@ -427,7 +427,9 @@
                 num = 35;
             if(table_sw[9] == 0 && num > 34 && num < 42)
                 num = 42;
-            if(table_sw[9] == 1 || table_sw[11] == 1)
+            if(table_sw[9] == 0 && table_sw[11] == 0 && num > 41 && num < 46)
+                num = 46;
+            else if(table_sw[9] == 1 || table_sw[11] == 1)
             {
                 if(table_sw[3] == 0 && table_sw[4] == 1 && num > 48 && num < 52)
                     num = 52;
@@ -438,7 +440,7 @@
         //B1・B2単発
         if(table_sw[3] == 1 && table_sw[4] == 0)
         {
-            if(num > 45 && num < 58)
+            if(num > 48 && num < 58)
                 num = 58;
         }
         else if(table_sw[3] == 0 && table_sw[4] == 1)
@@ -450,11 +452,11 @@
         }
         else if(table_sw[3] == 1 && table_sw[4] == 1 && num > 45 && num < 52)
             num = 52;
-        else if(table_sw[3] == 0 && table_sw[4] == 0 && num > 45 && num < 58)
-            num = 58;
+        else if(table_sw[3] == 0 && table_sw[4] == 0 && num > 45 && num < 59)
+            num = 59;
         //Cテーブル
         if(table_sw[5] == 0 && table_sw[6] == 0 && table_sw[7] == 0 && num > 57 && num < 72)
-                num = 72;
+            num = 72;
         else
         {
             if(table_sw[5] == 0 && num > 58 && num < 63)
@@ -474,7 +476,7 @@
             if(table_sw[2] == 0 && num > 79 && num < 84)
                 num = 84;
             if(table_sw[1] == 0 && table_sw[2] == 0 && num == 84)
-                num = LIBNUM - 1;
+                num = 85;
         }
         else if(num > 70 && num < LIBNUM - 1)
             num = LIBNUM - 1;
@@ -687,13 +689,13 @@
     if(now_num == 0)
     {
         c2_discovery = c3_discovery = LED[2] = LED[3] = 0;
-        state_lib[41][1] = state_lib[42][1] = 0.0;
-        state_lib[45][1] = state_lib[46][1] = 0.0;
+        state_lib[62][1] = state_lib[63][1] = 0.0;
+        state_lib[66][1] = state_lib[67][1] = 0.0;
     }
     int side_uss;
     side_uss = (can.get(8, 1)) * 2;
     
-    if(now_num == 39 && table_sw[6] == 1 && c2_discovery == 0)
+    if(now_num == 60 && table_sw[6] == 1 && c2_discovery == 0)
     {
         if(side_uss > 15 && side_uss < 85)
             c2_discovery =  LED[2] = 1;
@@ -701,8 +703,8 @@
         {
             c_odm1 = odm.y - 0.5;
             if(c_odm1 < 0)
-                state_lib[41][1] = state_lib[42][1] = 0;
-            else state_lib[41][1] = state_lib[42][1] = c_odm1;
+                state_lib[62][1] = state_lib[63][1] = 0;
+            else state_lib[62][1] = state_lib[63][1] = c_odm1;
             
             if(table_sw[7] == 1 && c3_discovery == 0)
             {
@@ -712,13 +714,13 @@
                 {
                     c_odm2 = odm.y - 0.4;
                     if(c_odm2 < 0)
-                        state_lib[45][1] = state_lib[46][1] = 0;
-                    else state_lib[45][1] = state_lib[46][1] = c_odm2;
+                        state_lib[66][1] = state_lib[67][1] = 0;
+                    else state_lib[66][1] = state_lib[67][1] = c_odm2;
                 }
             }
         }
     }
-    if(now_num == 47 && table_sw[7] == 1 && c3_discovery == 0)
+    if(now_num == 63 && table_sw[7] == 1 && c3_discovery == 0)
     {
         if(side_uss > 15 && side_uss < 85)
             c3_discovery = LED[3] = 1;
@@ -726,8 +728,8 @@
         {
             c_odm3 = odm.y - 0.4;
             if(c_odm3 < 0)
-                state_lib[45][1] = state_lib[46][1] = 0;
-            else state_lib[45][1] = state_lib[46][1] = c_odm3;
+                state_lib[66][1] = state_lib[67][1] = 0;
+            else state_lib[66][1] = state_lib[67][1] = c_odm3;
         }
     }
 }
--- a/stateLib.h	Thu Nov 08 14:58:20 2018 +0000
+++ b/stateLib.h	Sun Nov 11 08:13:37 2018 +0000
@@ -187,10 +187,10 @@
 topsPara para_B1_a = {35, 84.5};
 topsPara para_B1_b = {38, 83.8};
 
-topsPara para_B2 = {58, 85.0};
-topsPara para_B2_a = {58, 84.4};
-topsPara para_B2_b = {58, 83.9};
-topsPara para_B2_c = {58, 83.5};
+topsPara para_B2 = {58, 85.2};
+topsPara para_B2_a = {58, 84.6};
+topsPara para_B2_b = {58, 84.2};
+topsPara para_B2_c = {59, 83.9};
 
 topsPara para_C1 = {34, 84.2};
 topsPara para_C2 = {41, 85.2};