started thinking about goalie, to be tested, dunno if it works

code_midgen
u-siri-ous 2020-03-14 19:43:51 +01:00
parent 60f4878a08
commit bc0b19ccf1
1 changed files with 8 additions and 4 deletions

View File

@ -30,19 +30,23 @@ int dir, degrees2;
void Goalie::goalie(int plusang) { void Goalie::goalie(int plusang) {
if(ball->distance < CATCH_DIST) drive->prepareDrive(ball->angle, 350, 0); if(ball->distance < CATCH_DIST) drive->prepareDrive(ball->angle, 350, 0);
else{ else{
if(ball->angle > 345 || ball->angle < 15) plusang *= 0.15; /* if(ball->angle > 345 || ball->angle < 15) plusang *= 0.15;
FRONT */
if (ball->angle > 345 && ball->angle < 15) plusang *= 0.15;
if(ball->angle > 180) degrees2 = ball->angle - 360; if(ball->angle > 180) degrees2 = ball->angle - 360;
else degrees2 = ball->angle; else degrees2 = ball->angle;
if(degrees2 > 0) dir = ball->angle + plusang; //45 con 8 ruote if(degrees2 > 0) dir = ball->angle + plusang; //45 con 8 ruote
else dir = ball->angle - plusang; //45 con 8 ruote else dir = ball->angle - plusang; //45 con 8 ruote
if(dir < 0) dir = dir + 360; if(dir < 0) dir = dir + 360;
else dir = dir; else dir = dir;
storcimentoPorta(); storcimentoPorta();
if(ball->distance > TILT_DIST && (ball->angle > 340 || ball->angle < 20)) drive->prepareDrive(dir, 350, cstorc); if(ball->distance > TILT_DIST && (ball->angle > 340 || ball->angle < 20)){
else { plusang -= 20;
drive->prepareDrive(dir, 350, cstorc);
} else {
drive->prepareDrive(dir, 350, 0); drive->prepareDrive(dir, 350, 0);
cstorc = 0; cstorc = 0;
} }