kouhei umezawa / Mbed 2 deprecated 2022_NHK_B_UK

Dependencies:   HOSOKIkikou FEP_RX22 QEI R1370 ikarashiMDC_2byte_ver mbed 2022_NHK_B_canTR PID SEKIkikou

Files at this revision

API Documentation at this revision

Comitter:
umekou
Date:
Wed Oct 12 16:08:50 2022 +0000
Parent:
8:e1f1a91e9353
Child:
10:9623a4b1f2b1
Commit message:
huyouna komentoautowo kesimasita

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 12 16:05:05 2022 +0000
+++ b/main.cpp	Wed Oct 12 16:08:50 2022 +0000
@@ -45,7 +45,6 @@
         for (int i=0; i<8; i++) b[i]=0;
         for (int i=0; i<4; i++) stick[i]=0;
     }
-//    canTR();
     /*
     for (int i=0; i<4; i++) pc.printf("%d ", stick[i]);
     pc.printf(" | ");
@@ -58,7 +57,6 @@
     encoderValue[4] = (float)enc2.getPulses();
     encoderValue[5] = (float)enc3.getPulses();
     encoderValue[6] = (float)enc4.getPulses();
-//    canTR();
 //    for (int i=0; i<4; i++) pc.printf("%d  ", encoderValue[i]);
 //    pc.printf("\r\n ");
 }
@@ -74,7 +72,6 @@
         motorSpeed[10]=three;
         motorSpeed[11]=four;
     }
-//    canTR();
 }
 
 void PIDset(){
@@ -90,7 +87,6 @@
     for(int i=8; i < 12; i++){
         motorSpeed[i]-=front.compute();
     }
-//    canTR();
 }
 
 int main()
@@ -100,10 +96,6 @@
     stop = 1;
     led = 1;
     
-//    int currentMode=1;
-//    int bc=0,bn=0;
-//    int sa=0;
-    
     printf("success!\r\n");
     
     for(int i=0; i < 8; i++){
@@ -113,11 +105,6 @@
 //    canAllReset();   
     PIDset();
     SEKIkikou seki(&motor[6], &motor[4], &motor[5], &b[0], &b[1], &b[2], &b[3], &encoderValue[4], &encoderValue[5], &encoderValue[6]);
-//    seki.stopAll();
-//    SEKIkikou seki(&motor[6], &motor[4], &motor[5], NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-    
-    
-    
     
     while(1) {
         recieveController();
@@ -125,63 +112,8 @@
         updateenc();
         frontAngle=jyroValue;
         
-        /*
-        bc=b[7]-bn;
-        bn=b[7];
-        
-        if(currentMode==1){
-            if(bc==1){
-                currentMode=2;
-                seki.init(&motor[6],&motor[4], &motor[5], &b[0], &b[1], &b[2], &b[3], &encoderValue[4], &encoderValue[5], &encoderValue[6]);
-                seki.runAll(0,0,0);
-                allanglemove(0,0,0,0);
-            }else if(b[0]){
-                allanglemove(-1,-1,1,1);
-            }else if(b[1]){
-                allanglemove(1,-1,-1,1);
-            }else if(b[2]){
-                allanglemove(1,1,-1,-1);
-            }else if(b[3]){
-                allanglemove(-1,1,1,-1);
-            }else if(b[4]||b[6]){
-                sa+=b[4]-b[6];
-                if(sa==360)sa=0;
-                frontAngle=jyroValue-sa;
-                if(frontAngle<=-180){
-                    frontAngle+=360;
-                }else if(frontAngle>180){
-                    frontAngle-=360;
-                }
-                allanglemove(0,0,0,0);
-                seki.runAll(0,0,0);
-            }else if(b[5]){
-                sa=0;
-                frontAngle=jyroValue;
-                allanglemove(0,0,0,0);
-            }else{
-                allanglemove(0,0,0,0);
-            }
-            addPID();
-        }else if(currentMode==2){
-            if(bc==1){
-                currentMode=3;
-                seki.stopAll();
-                seki.runAll(0,0,0);
-            }else{
-                seki.runAll(-0.3,0.3,0.3);
-            }
-            allanglemove(0,0,0,0);
-            addPID();
-        }else if(currentMode==3){
-            if(bc==1){
-                currentMode=1;
-                seki.stopAll();
-                seki.runAll(0,0,0);
-            }
-            seki.runAll(0,0,0);*/
-            allanglemove(0,0,0,0);
-            addPID();
-//        }
+        allanglemove(0,0,0,0);
+        addPID();
         
         if(b[5]&&b[6]){
             motorSpeed[15]=0;