yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Revision:
23:f45eb02433a5
Parent:
20:13934809e117
Child:
24:b4a89db4ed72
--- a/workinfo/workinfo.cpp	Tue Aug 28 03:09:39 2018 +0000
+++ b/workinfo/workinfo.cpp	Sun Sep 02 07:53:06 2018 +0000
@@ -9,12 +9,29 @@
 const int kWorkAreaNum = 6;
 const int kCommonAreaNum = 17;
 const int kBoxNum = 12;
-
+//ワークエリアの配列のいれかた
+int kWorkAreaIndex[kWorkAreaNum] = {
+    3, 4, 5,
+    0, 1, 2,
+};
+//共通ワークエリア
+const int kCommonAreaIndex[kCommonAreaNum] = {
+    17, 18, 19, 20, 21, 22,
+    12, 13, 14, 15, 16,
+    6,  7,  8,  9, 10, 11,
+};
+//shootingboxの配列のいれかた
+const int kBoxIndex[kBoxNum] = {
+    11, 10,  9,
+    8,  7,  6,
+    5,  4,  3,
+    2,  1,  0,
+};
 //////////////////////////////変更出来るパラメータ
 //priority 取る順番を決める
 const int kWorkAreaPriority[kWorkAreaNum] = {
-    103, 102, 0,
-    102, 101, 100,
+    100, 102, 103,
+    104, 105, 106,
 };
 const int kCommonAreaPriority[kCommonAreaNum] = {
     17, 16, 15, 14, 13, 12,
@@ -27,15 +44,15 @@
     {0,0,0},{0,0,0},{0,0,0},
 };
 const int kCommonAreaCorrect[kCommonAreaNum][3] = {
-    {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
-    {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
-    {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
+    {0,0,30},{0,0,30},{0,0,30},{0,0,30},{0,0,30},{0,0,30},
+    {0,0,30},{0,0,30},{0,0,30},{0,0,30},{0,0,30},
+    {0,0,30},{0,0,30},{0,0,30},{0,0,30},{0,0,30},{0,0,30},
 };
 const int kBoxCorrect[kBoxNum][3] = {
-    {0,0,0},{0,0,0},{0,0,0},
-    {0,0,0},{0,0,0},{0,0,0},
-    {0,0,0},{0,0,0},{0,0,0},
-    {0,0,0},{0,0,0},{0,0,0},
+    {0,0,-5},{0,0,-5},{0,0,-5},
+    {0,0,-5},{0,0,-5},{0,0,-5},
+    {0,0,-5},{0,0,-5},{0,0,-5},
+    {0,0,-5},{0,0,-5},{0,0,-5},
 };
 const int kHandCenter = 22.80;//想定先端と実際の先端位置のずれ
 
@@ -55,24 +72,7 @@
 WorkPosi work[kWorkAreaNum + kCommonAreaNum + 1];//最後の1つは番兵
 BoxPosi shootingbox[kBoxNum];
 Pattern now_pattern = NOPATTERN;
-//ワークエリアの配列のいれかた
-int kWorkAreaIndex[kWorkAreaNum] = {
-    3, 4, 5,
-    0, 1, 2,
-};
-//共通ワークエリア
-const int kCommonAreaIndex[kCommonAreaNum] = {
-    17, 18, 19, 20, 21, 22,
-    12, 13, 14, 15, 16,
-    6,  7,  8,  9, 10, 11,
-};
-//shootingboxの配列のいれかた
-const int kBoxIndex[kBoxNum] = {
-    11, 10,  9,
-    8,  7,  6,
-    5,  4,  3,
-    2,  1,  0,
-};
+
 
 //関数名
 void AreaNameSetup();//areanameを入れる。
@@ -171,7 +171,7 @@
         work[i+3].position[1]=370;
     }
     //z座標
-    for(int i=0; i<6; i++) work[i].position[2]=-350;
+    for(int i=0; i<6; i++) work[i].position[2]=-420;
 //共通ワークエリア
     //x座標
     for(int i=kCommonStart; i<12; i++) {
@@ -183,20 +183,21 @@
     //y座標
     for(int i=kCommonStart; i<sizeof(work)/sizeof(work[0]); i++) {
         if(i<12) {
-            work[i].position[1]=595+30;
+            work[i].position[1]=595;
         } else if(i<17) {
-            work[i].position[1]=675+30;
+            work[i].position[1]=675;
         } else if(i< kCommonStart + kCommonAreaNum) {
-            work[i].position[1]=755+30;
+            work[i].position[1]=755;
         }
     }
     //z座標
-    for(int i=kCommonStart; i<kCommonStart + kCommonAreaNum; i++) work[i].position[2]=-350;
-    for(int i = kWorkStart; i < kWorkAreaNum; i++) {
+    for(int i=kCommonStart; i<kCommonStart + kCommonAreaNum; i++) work[i].position[2]=-400;
+    for(int i = 0; i < kWorkAreaNum; i++) {
         for(int j = 0; j < 3; j++) work[kWorkAreaIndex[i]].position[j] += kWorkAreaCorrect[i][j];
     }
-    for(int i = kCommonStart; i < kCommonAreaNum; i++) {
+    for(int i = 0; i < kCommonAreaNum; i++) {
         for(int j = 0; j < 3; j++) work[kCommonAreaIndex[i]].position[j] += kCommonAreaCorrect[i][j];
+        DEBUG("work %d %f,%f,%f\r\n",kCommonAreaIndex[i], work[kCommonAreaIndex[i]].position[0], work[kCommonAreaIndex[i]].position[1], work[kCommonAreaIndex[i]].position[2] );
     }
     DEBUG("WorkPosition() finish\r\n");
 }
@@ -214,14 +215,14 @@
     for(int i = 0; i < kBoxNum; i++) shootingbox[i].position[0] += kHandCenter;
     //y座標
     for(int i=0; i<4; i++) {
-        shootingbox[i*3].position[1]=160+80*i+30;
-        shootingbox[i*3+1].position[1]=160+80*i+30;
-        shootingbox[i*3+2].position[1]=160+80*i+30;
+        shootingbox[i*3].position[1]=160+80*i;
+        shootingbox[i*3+1].position[1]=160+80*i;
+        shootingbox[i*3+2].position[1]=160+80*i;
     }
     //z座標
-    for(int i=0; i<sizeof(shootingbox)/sizeof(shootingbox[0]); i++) shootingbox[i].position[2]=95;
+    for(int i=0; i<sizeof(shootingbox)/sizeof(shootingbox[0]); i++) shootingbox[i].position[2]=85;
     for(int i = 0; i < kBoxNum; i++) {
-        for(int j = 0; j < 3; j++) work[kBoxIndex[i]].position[j] += kBoxCorrect[i][j];
+        for(int j = 0; j < 3; j++) shootingbox[kBoxIndex[i]].position[j] += kBoxCorrect[i][j];
     }
     DEBUG("ShootingBoxPosition() finish\r\n");
 }