2015_robocon_bteam / Mbed 2 deprecated 2015robot_main_zenkoku

Dependencies:   PID QEI mbed

Committer:
DeguNaoto
Date:
Thu Nov 12 07:23:30 2015 +0000
Revision:
33:a4323c20494b
Parent:
32:b8c8ad2eeca7
Child:
34:aa2a5c888a27
20151111 ???

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DeguNaoto 0:b613dc16f27d 1 #ifndef MANUALMODE_H
DeguNaoto 0:b613dc16f27d 2 #define MANUALMODE_H
DeguNaoto 0:b613dc16f27d 3
DeguNaoto 0:b613dc16f27d 4 void manualIM920()
DeguNaoto 0:b613dc16f27d 5 {
DeguNaoto 33:a4323c20494b 6 /*if(b==7){ //mode change
DeguNaoto 0:b613dc16f27d 7 if(edge7){
DeguNaoto 0:b613dc16f27d 8 edge7=0;
DeguNaoto 0:b613dc16f27d 9 autoflag=1;
DeguNaoto 0:b613dc16f27d 10 Indicator4=1;
DeguNaoto 0:b613dc16f27d 11 IndicatorAuto=0;
DeguNaoto 30:cd344beb415d 12 resetState(1);
DeguNaoto 0:b613dc16f27d 13 flaga=0;
DeguNaoto 0:b613dc16f27d 14 step=114;
DeguNaoto 0:b613dc16f27d 15 CStep=114;
DeguNaoto 30:cd344beb415d 16 mstep=114;
DeguNaoto 30:cd344beb415d 17 mCStep=114;
DeguNaoto 3:8d8c25c556ae 18 spcount=speed;
DeguNaoto 26:760f1bce8214 19 dpcount=0.0;
DeguNaoto 0:b613dc16f27d 20 }
DeguNaoto 33:a4323c20494b 21 }*/
DeguNaoto 33:a4323c20494b 22 if(modeflag){ //mode change
DeguNaoto 33:a4323c20494b 23 autoflag=1;
DeguNaoto 33:a4323c20494b 24 Indicator4=1;
DeguNaoto 33:a4323c20494b 25 IndicatorAuto=0;
DeguNaoto 33:a4323c20494b 26 resetState(1);
DeguNaoto 33:a4323c20494b 27 flaga=0;
DeguNaoto 33:a4323c20494b 28 step=114;
DeguNaoto 33:a4323c20494b 29 CStep=114;
DeguNaoto 33:a4323c20494b 30 mstep=114;
DeguNaoto 33:a4323c20494b 31 mCStep=114;
DeguNaoto 33:a4323c20494b 32 spcount=speed;
DeguNaoto 33:a4323c20494b 33 dpcount=0.0;
DeguNaoto 0:b613dc16f27d 34 }
DeguNaoto 33:a4323c20494b 35 if(b==1){
DeguNaoto 33:a4323c20494b 36 if(edge1){
DeguNaoto 33:a4323c20494b 37 edge1=0;
DeguNaoto 33:a4323c20494b 38 // swingspeed=15.0;
DeguNaoto 33:a4323c20494b 39 swingspeed=20.0;
DeguNaoto 24:6d2573d6f2b6 40 resetSwingSpeed = 1;
DeguNaoto 24:6d2573d6f2b6 41 interruptSwingSpeed.attach(&countSwingSpeed, 0.05);
DeguNaoto 24:6d2573d6f2b6 42 enableSwing=1;
DeguNaoto 24:6d2573d6f2b6 43 /*for(float i=0.0;i<0.6;i+=0.01){
DeguNaoto 3:8d8c25c556ae 44 Motor_swing=i;
DeguNaoto 24:6d2573d6f2b6 45 wait(0.01);
DeguNaoto 3:8d8c25c556ae 46 }
DeguNaoto 24:6d2573d6f2b6 47 Motor_swing = 0.6;*/
DeguNaoto 3:8d8c25c556ae 48 }
DeguNaoto 3:8d8c25c556ae 49 }
DeguNaoto 33:a4323c20494b 50 else if(b==3){
DeguNaoto 33:a4323c20494b 51 if(edge1){
DeguNaoto 33:a4323c20494b 52 edge1=0;
DeguNaoto 33:a4323c20494b 53 swingspeed=20.0;
DeguNaoto 33:a4323c20494b 54 resetSwingSpeed = 1;
DeguNaoto 33:a4323c20494b 55 interruptSwingSpeed.attach(&countSwingSpeed, 0.05);
DeguNaoto 33:a4323c20494b 56 enableSwing=1;
DeguNaoto 33:a4323c20494b 57 }
DeguNaoto 33:a4323c20494b 58 }
DeguNaoto 33:a4323c20494b 59 else if(b==4){
DeguNaoto 3:8d8c25c556ae 60 interruptSwingSpeed.detach();
DeguNaoto 3:8d8c25c556ae 61 targSwingRadVelocity = 0.0;
DeguNaoto 24:6d2573d6f2b6 62 enableSwing=0;
DeguNaoto 3:8d8c25c556ae 63 contSwing.reset();
DeguNaoto 7:4aa57a35ec0b 64 sendData(2,8);
DeguNaoto 3:8d8c25c556ae 65 Motor_swing = 0.0;
DeguNaoto 3:8d8c25c556ae 66 }
DeguNaoto 26:760f1bce8214 67 else if(b==2){
DeguNaoto 0:b613dc16f27d 68 if(edge2){
DeguNaoto 0:b613dc16f27d 69 edge2=0;
DeguNaoto 33:a4323c20494b 70 enableShoot=!enableShoot;
DeguNaoto 33:a4323c20494b 71 if(enableShoot) sendData(1,11);
DeguNaoto 33:a4323c20494b 72 else sendData(1,12);
DeguNaoto 0:b613dc16f27d 73 }
DeguNaoto 0:b613dc16f27d 74 }
DeguNaoto 33:a4323c20494b 75 else if((b==5)&&(!flaga)){ //Swing Start
DeguNaoto 33:a4323c20494b 76 if(edge5){
DeguNaoto 33:a4323c20494b 77 edge5=0;
DeguNaoto 30:cd344beb415d 78 resetState(0);
DeguNaoto 32:b8c8ad2eeca7 79 flagf=0;
DeguNaoto 30:cd344beb415d 80 spcount=0.0;
DeguNaoto 30:cd344beb415d 81 dpcount=0.0;
DeguNaoto 30:cd344beb415d 82 direction_controller.setBias(0.0);
DeguNaoto 32:b8c8ad2eeca7 83 sendData(5,60); //right
DeguNaoto 30:cd344beb415d 84 wait(0.05);
DeguNaoto 32:b8c8ad2eeca7 85 sendData(4,60); //left
DeguNaoto 30:cd344beb415d 86 wait(0.05);
DeguNaoto 32:b8c8ad2eeca7 87 sendData(6,30); //middle
DeguNaoto 30:cd344beb415d 88 stateR = 90;
DeguNaoto 30:cd344beb415d 89 stateL = 90;
DeguNaoto 30:cd344beb415d 90 mstep = 0;
DeguNaoto 33:a4323c20494b 91 mCStep = 114;
DeguNaoto 33:a4323c20494b 92 flaga = 1;
DeguNaoto 33:a4323c20494b 93 }
DeguNaoto 33:a4323c20494b 94 }
DeguNaoto 33:a4323c20494b 95 else if((b==8)&&(!flaga)){
DeguNaoto 33:a4323c20494b 96 if(edge8){
DeguNaoto 33:a4323c20494b 97 edge8=0;
DeguNaoto 33:a4323c20494b 98 resetState(1);
DeguNaoto 33:a4323c20494b 99 flagf=1;
DeguNaoto 33:a4323c20494b 100 spcount=0.0;
DeguNaoto 33:a4323c20494b 101 dpcount=0.0;
DeguNaoto 33:a4323c20494b 102 direction_controller.setBias(0.0);
DeguNaoto 33:a4323c20494b 103 #ifdef BLUE
DeguNaoto 33:a4323c20494b 104 sendData(5,60); //right
DeguNaoto 33:a4323c20494b 105 wait(0.05);
DeguNaoto 33:a4323c20494b 106 sendData(4,60); //left
DeguNaoto 33:a4323c20494b 107 wait(0.05);
DeguNaoto 33:a4323c20494b 108 sendData(6,10); //middle
DeguNaoto 33:a4323c20494b 109 stateR = 69;
DeguNaoto 33:a4323c20494b 110 stateL = 69;
DeguNaoto 33:a4323c20494b 111 #else
DeguNaoto 33:a4323c20494b 112 sendData(5,60); //right
DeguNaoto 33:a4323c20494b 113 wait(0.05);
DeguNaoto 33:a4323c20494b 114 sendData(4,60); //left
DeguNaoto 33:a4323c20494b 115 wait(0.05);
DeguNaoto 33:a4323c20494b 116 sendData(6,10); //middle
DeguNaoto 33:a4323c20494b 117 stateR = 69;
DeguNaoto 33:a4323c20494b 118 stateL = 69;
DeguNaoto 33:a4323c20494b 119 #endif
DeguNaoto 33:a4323c20494b 120 stateR = 90;
DeguNaoto 33:a4323c20494b 121 stateL = 90;
DeguNaoto 33:a4323c20494b 122 mstep = 10;
DeguNaoto 33:a4323c20494b 123 mCStep = 0;
DeguNaoto 30:cd344beb415d 124 flaga = 1;
DeguNaoto 26:760f1bce8214 125 }
DeguNaoto 26:760f1bce8214 126 }
DeguNaoto 0:b613dc16f27d 127 if(b!=1) edge1=1;
DeguNaoto 0:b613dc16f27d 128 if(b!=2) edge2=1;
DeguNaoto 0:b613dc16f27d 129 if(b!=3) edge3=1;
DeguNaoto 0:b613dc16f27d 130 if(b!=4) edge4=1;
DeguNaoto 0:b613dc16f27d 131 if(b!=5) edge5=1;
DeguNaoto 21:bdf8ac5c200c 132 if(b!=6) edge6=1;
DeguNaoto 30:cd344beb415d 133 if(b!=7) edge7=1;
DeguNaoto 0:b613dc16f27d 134 if(b!=8) edge8=1;
DeguNaoto 0:b613dc16f27d 135 if(b!=9) edge9=1;
DeguNaoto 30:cd344beb415d 136 if(b!=10) edge10=1;
DeguNaoto 30:cd344beb415d 137 if(b!=11) edge11=1;
DeguNaoto 0:b613dc16f27d 138 }
DeguNaoto 13:57d8e360e9aa 139
DeguNaoto 30:cd344beb415d 140 #endif /*manualMode.h*/