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-15
- Revision:
- 36:b8954b13a6d5
- Parent:
- 35:7b6786193aa2
- Child:
- 37:75fcd28f48c7
File content as of revision 36:b8954b13a6d5:
#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,71); //over // sendData(5,68); //over wait(0.05); sendData(4,71); //front // sendData(4,68); //front wait(0.05); sendData(6,12); //middle // sendData(6,7); //middle stateR = 69; stateL = 69; #else sendData(5,69); //right wait(0.05); sendData(4,69); //left wait(0.05); sendData(6,10); //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,65); //right sendData(5,69); //right wait(0.05); // sendData(4,65); //left sendData(4,69); //left wait(0.05); // sendData(6,10); //middle sendData(6,12); //middle stateR = 69; stateL = 69; #else sendData(5,69); //right wait(0.05); sendData(4,69); //left wait(0.05); sendData(6,69); //middle stateR = 69; stateL = 69; #endif step = 10; CStep = 10; 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*/