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.
Diff: main_ps3.cpp
- Revision:
- 37:75fcd28f48c7
- Parent:
- 36:b8954b13a6d5
- Child:
- 38:f4e9893641ac
--- a/main_ps3.cpp Sun Nov 15 00:30:44 2015 +0000 +++ b/main_ps3.cpp Sun Nov 15 11:45:29 2015 +0000 @@ -64,11 +64,11 @@ // targ_sita=0.0; targ_sita=-0.03; } - if((step==3)&&(x<1700.0)) { + if((step==3)&&(x<1800.0)) { targ_sita=PI/4; step=4; } - if((step==4)&&(x<800.0)) { + if((step==4)&&(x<750.0)) { dpcount=speed; step=114; } @@ -90,6 +90,8 @@ if(!skip) sendData(1,8); CStep=4; } + if((x>8500.0)&&(CStep==4)) CStep=5; + ///////////////////////////////////////// /*if((x<7200.0)&&(CStep==4)) { if(!skip) sendData(1,4); //over CStep=5; @@ -103,26 +105,26 @@ CStep=7; }*/ ///////////////////////////////////////// - if((x<7850.0)&&(CStep==4)) { + if((x<7870.0)&&(CStep==5)) { if(!skip) sendData(1,6); //front - CStep=5; - } - if((x<6700.0)&&(CStep==5)) { - if(!skip) sendData(1,5); //middle CStep=6; } - if((x<5600.0)&&(CStep==6)) { - if(!skip) sendData(1,4); //over + if((x<6800.0)&&(CStep==6)) { + if(!skip) sendData(1,5); //middle CStep=7; } + if((x<5550.0)&&(CStep==7)) { + if(!skip) sendData(1,4); //over + CStep=8; + } ///////////////////////////////////////// - if((x<3000.0)&&(CStep==7)){ + if((x<3000.0)&&(CStep==8)){ sendData(7,0); CStep=114; } /********************************Own & Opponent Mode*********************************/ - if((step==10)&&((9800.0>x)&&(x>700.0))) { + if((step==10)&&((10000.0>x)&&(x>700.0))) { targ_sita=-0.03; // targ_sita=0.0; step=11; @@ -141,7 +143,7 @@ // targ_sita=0.0; targ_sita=-0.03; } - if((step==13)&&(x<1400.0)) { + if((step==13)&&(x<1450.0)) { targ_sita=PI/4; step=14; } @@ -163,27 +165,30 @@ if(!skip) sendData(1,3); CStep=13; } - if((x>9500.0)&&(CStep==13)) { - if(!skip) sendData(1,8); + if((x>9800.0)&&(CStep==13)) { + sendData(1,8); CStep=14; } - if((x<9400.0)&&(CStep==14)) { + if((x>9900.0)&&(CStep==14)) CStep=15; + if((x<9680.0)&&(CStep==15)) { //7.8 if(!skip) sendData(1,4); - CStep=15; - } - if((x<7250.0)&&(CStep==15)) { - if(!skip) sendData(1,5); CStep=16; } - if((x<4850.0)&&(CStep==16)) { -// if((x<5450.0)&&(CStep==16)) { - if(!skip) sendData(1,6); + if((x<7900.0)&&(CStep==16)) { //7.8 +// if((x<7950.0)&&(CStep==16)) { //7.8 + if(!skip) sendData(1,5); CStep=17; } - if((x<1000.0)&&(CStep==17)){ + if((x<5600.0)&&(CStep==17)) { //7.8 +// if((x<5750.0)&&(CStep==17)) { //7.8 + if(!skip) sendData(1,6); + CStep=18; + } + if((x<1000.0)&&(CStep==18)){ sendData(7,0); CStep=114; } + #else /********************************Own & Middle Mode*********************************/ if((step==0)&&((10000.0>x)&&(x>800.0))) { @@ -298,12 +303,12 @@ if(!skip) sendData(1,6); //over CStep=15; } - if((x<7250.0)&&(CStep==15)) { + if((x<6600.0)&&(CStep==15)) { if(!skip) sendData(1,5); //middle CStep=16; } - if((x<4850.0)&&(CStep==16)) { -// if((x<5450.0)&&(CStep==16)) { + if((x<4820.0)&&(CStep==16)) { +// if((x<4850.0)&&(CStep==16)) { if(!skip) sendData(1,4); //front CStep=17; } @@ -318,63 +323,76 @@ manualIM920(); /*IM920 button*/ #ifdef BLUE /********************************Swing Mode(middle)*********************************/ - if((mstep==0)&&((10000.0>x)&&(x>1500.0))) { + if((mstep==0)&&((10000.0>x)&&(x>1550.0))) { dpcount=speed; mstep=1; } if((mstep==1)&&((velocity<5.0)&&(velocity>-5.0))){ targ_sita=PI/4.0; - swingmoved=1; - mstep=114; + swingmoved=2; + mstep=251; + } + if((mstep==251)&&(((targ_sita-sita)<0.01)&&((targ_sita-sita)>-0.01))){ + flagf=2; } if(mstep==2){ mstep=3; - targ_sita=3.0*PI/4.0; + targ_sita=3.0*PI/4.0-PI/8.0; + sendData(7,0); + flagf=0; } if((mstep==3)&&(((targ_sita-sita)<0.05)&&((targ_sita-sita)>-0.05))){ flagf=1; targ_velocity=speed; mstep=4; } - if((mstep==4)&&(x<400.0)){ - targ_sita=PI; + if((mstep==4)&&(x<1300.0)){ + targ_sita=5*PI/6.0; mstep=5; } - if((mstep==5)&&(x<0.0)){ + if((mstep==5)&&(x<-10.0)){ targ_velocity=0.0; + targ_sita=3.0*PI/4.0; mstep=114; } /********************************Swing Mode(over)*********************************/ - if((mstep==10)&&((10000.0>x)&&(x>1500.0))) { +// if((mstep==10)&&((10000.0>x)&&(x>1500.0))) { + if((mstep==10)&&((10000.0>x)&&(x>1550.0))) { dpcount=speed; mstep=11; } if((mstep==11)&&((velocity<5.0)&&(velocity>-5.0))){ - targ_sita=PI/4.0+PI/16.0; + targ_sita=PI/4.0+PI/16.0+PI/45.0; swingmoved=2; - mstep=114; + mstep=252; + } + if((mstep==252)&&(((targ_sita-sita)<0.01)&&((targ_sita-sita)>-0.01))){ + flagf=2; } if(mstep==12){ mstep=13; - targ_sita=3.0*PI/4.0; + targ_sita=3.0*PI/4.0-PI/8.0; + sendData(7,0); + flagf=0; } if((mstep==13)&&(((targ_sita-sita)<0.05)&&((targ_sita-sita)>-0.05))){ flagf=1; targ_velocity=speed; mstep=14; } - if((mstep==14)&&(x<400.0)){ - targ_sita=PI; + if((mstep==14)&&(x<1300.0)){ + targ_sita=5*PI/6.0; mstep=15; } - if((mstep==15)&&(x<0.0)){ + if((mstep==15)&&(x<-10.0)){ targ_velocity=0.0; + targ_sita=3.0*PI/4.0; mstep=114; } - /********************************Swing Mode(over)*********************************/ + /********************************Swing Mode(front)*********************************/ if((mstep==20)&&((10000.0>x)&&(x>1500.0))) { dpcount=speed; mstep=21; @@ -387,17 +405,18 @@ if(mstep==22){ mstep=23; targ_sita=3.0*PI/4.0; + sendData(7,0); } if((mstep==23)&&(((targ_sita-sita)<0.05)&&((targ_sita-sita)>-0.05))){ flagf=1; targ_velocity=speed; mstep=24; } - if((mstep==24)&&(x<400.0)){ + if((mstep==24)&&(x<1300.0)){ targ_sita=PI; mstep=25; } - if((mstep==25)&&(x<0.0)){ + if((mstep==25)&&(x<-10.0)){ targ_velocity=0.0; mstep=114; }