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.
Fork of IEEE_14_Freescale by
Diff: game.cpp
- Revision:
- 45:9c520ebc38e0
- Parent:
- 39:e61dd30febfc
- Child:
- 46:faad265d8ce9
- Child:
- 48:519deb1d4dff
--- a/game.cpp Tue Apr 01 02:16:35 2014 +0000 +++ b/game.cpp Thu Apr 03 02:44:36 2014 +0000 @@ -145,7 +145,7 @@ void gamePlayer::runSecondRow(){ float gapCheck = -2; - if(row != 1){ + if(row != 1 || row != 2){ DBGPRINT("Not in second row for runSecondRow",1); return; } @@ -264,7 +264,7 @@ } desiredHeading = 0; break; - } /*else { //need to reverse angles + } else { //correct our direction if(!(waveGaps[row]==i-1) && i==5){ //we have enough info to correct direction @@ -274,7 +274,7 @@ desiredHeading = (atan2(8.0-wallDist,16.0)*180.0/3.14159)/2; DBGPRINT("Hd: %f, des: %f\r\n",heading,desiredHeading); DBGPRINT("Turning %f degrees to fix and %f to %f\r\n",-(-heading+desiredHeading),direction,direction-heading); - bot.smoothMove((8000.0/360.0)*((-heading+desiredHeading)),1,40); + bot.smoothMove((8000.0/360.0)*(-(-heading+desiredHeading)),1,40); } else if(!(waveGaps[row]==i-1)){ //we have enough info to correct direction // for the move to the next stop @@ -283,14 +283,14 @@ desiredHeading = (atan2(8.0-wallDist,16.0)*180.0/3.14159)/2; DBGPRINT("Hd: %f, des: %f\r\n",heading,desiredHeading); DBGPRINT("Turning %f degrees to fix and %f to %f\r\n",-(-heading+desiredHeading),direction,direction-heading); - bot.smoothMove((8000.0/360.0)*((-heading+desiredHeading)),1,40); + bot.smoothMove((8000.0/360.0)*(-(-heading+desiredHeading)),1,40); } else { // not enough info // this should never happen because we are greedy and turn the first time we see a gap DBGPRINT("Re-Aligning %f degrees or %f\r\n",desiredHeading,(8000.0/360.0)*(desiredHeading)); - bot.smoothMove((8000.0/360.0)*(-desiredHeading),1,40); + bot.smoothMove((8000.0/360.0)*(desiredHeading),1,40); desiredHeading = 0; - }*/ + } oldWallDist = wallDist; } } @@ -315,7 +315,26 @@ } bot.smoothMove((8000.0/360.0)*(90),1,40); bot.smoothMove(290*(-3),0,40); - row = 1; column = waveGaps[row]; + row = 2; } +}} + +void gamePlayer::approachRig(){ + while(1){ + if(rigOnFire == 1){ + bot.smoothMove(290*11.625-(column*16),0,40); + bot.smoothMove(290*(3),0,40); + bot.smoothMove((8000.0/360.0)*(-90),1,40); + } else if(rigOnFire == 2){ + bot.smoothMove(290*40-(column*16),0,40); + bot.smoothMove(290*(3),0,40); + bot.smoothMove((8000.0/360.0)*(-90),1,40); + } else if(rigOnFire == 3){ + bot.smoothMove(290*68.375-(column*16),0,40); + bot.smoothMove(290*(3),0,40); + bot.smoothMove((8000.0/360.0)*(-90),1,40); + } + break; + } } \ No newline at end of file