Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
autoMode.h
- Committer:
- DeguNaoto
- Date:
- 2015-11-16
- Revision:
- 39:5ba406327aa3
- Parent:
- 38:f4e9893641ac
- Child:
- 43:a7423cfee3c8
File content as of revision 39:5ba406327aa3:
#ifndef AUTOMODE_H #define AUTOMODE_H /***PID Controller***/ PID velocity_controller(9.0,5274.0,0.0,RATE); PID direction_controller(36.0,3.5,0.0,RATE); //PID direction_controller(36.0,3.0,0.0,RATE); /***IM920 correspondence***/ void autoIM920() { /*if(b==7){ //mode change if(edge7) { edge7=0; autoflag=0; Indicator4=0; IndicatorAuto=1; targ_velocity=0.0; resetState(0); flaga=0; step=114; CStep=114; mstep=114; mCStep=114; spcount=speed; dpcount=0.0; } }*/ if(!modeflag){ //mode change autoflag=0; Indicator4=0; IndicatorAuto=1; targ_velocity=0.0; resetState(1); flaga=0; step=114; CStep=114; mstep=114; mCStep=114; spcount=speed; dpcount=0.0; swingmoved=0; } if((b==6)&&(!flaga)){ //Own & Middle Start if(edge6){ edge6=0; resetState(1); flagf=1; spcount=0.0; dpcount=0.0; direction_controller.setBias(0.0); #ifdef BLUE sendData(5,70); //over // sendData(5,68); //over wait(0.05); sendData(4,70); //front // sendData(4,68); //front wait(0.05); sendData(6,14); //middle // sendData(6,7); //middle stateR = 69; stateL = 69; #else sendData(4,70); //over // sendData(5,68); //over wait(0.05); sendData(5,70); //front // sendData(4,68); //front wait(0.05); sendData(6,14); //middle // sendData(6,7); //middle stateR = 69; stateL = 69; #endif step = 0; CStep = 0; flaga = 1; } } else if((b==5)&&(!flaga)){ //Own & Opponent Start if(edge5){ edge5=0; resetState(1); flagf=1; spcount=0.0; dpcount=0.0; direction_controller.setBias(0.0); #ifdef BLUE sendData(5,68); // sendData(5,67); //over cylinder4 wait(0.05); sendData(4,72); // sendData(4,75); //front wait(0.05); sendData(6,1); //middle stateR = 69; stateL = 69; #else // sendData(4,65); sendData(4,67); //over cylinder6 wait(0.05); // sendData(5,75); sendData(5,72); //front cylinder4 wait(0.05); // sendData(6,1); //middle sendData(6,3); //middle stateR = 69; stateL = 69; #endif step = 10; CStep = 10; flaga = 1; } } if((b==8)&&(!flaga)){ //Middle Start if(edge8){ edge6=0; resetState(1); flagf=1; spcount=0.0; dpcount=0.0; direction_controller.setBias(0.0); #ifdef BLUE sendData(5,69); //over // sendData(5,69); //over wait(0.05); sendData(4,70); //front // sendData(4,71); //front wait(0.05); sendData(6,11); //middle // sendData(6,7); //middle stateR = 69; stateL = 69; #else sendData(4,68); //over // sendData(5,69); //over wait(0.05); sendData(5,71); //front // sendData(4,71); //front wait(0.05); sendData(6,11); //middle // sendData(6,7); //middle stateR = 69; stateL = 69; #endif step = 0; CStep = 4; flaga = 1; } } /*else if(b==1){ if(edge1){ edge1=0; sendData(1,5); } } else if(b==2){ if(edge2){ edge2=0; sendData(1,4); } } else if(b==3){ if(edge3){ edge3=0; sendData(1,6); } } else if(b==4){ if(edge4){ edge4=0; sendData(1,8); } }*/ /*if(a2){ skip = 1; } else if(!a2){ skip = 0; }*/ skip=0; if(b!=1) edge1=1; if(b!=2) edge2=1; if(b!=3) edge3=1; if(b!=4) edge4=1; if(b!=5) edge5=1; if(b!=6) edge6=1; if(b!=7) edge7=1; if(b!=8) edge8=1; if(b!=9) edge9=1; if(b!=10) edge10=1; if(b!=11) edge11=1; } #endif /*autoMode.h*/