2019-12-05 11:50:58 +01:00
|
|
|
#include "goalie.h"
|
|
|
|
|
2019-12-05 13:31:21 +01:00
|
|
|
Goalie::Goalie(){ }
|
2019-12-05 11:50:58 +01:00
|
|
|
|
2019-12-05 13:31:21 +01:00
|
|
|
void Goalie::goalie(){
|
|
|
|
digitalWrite(LED_G, HIGH);
|
2019-12-05 11:50:58 +01:00
|
|
|
if(ball->ballSeen){
|
2019-12-05 14:29:16 +01:00
|
|
|
if(ball->angle >= 0 && ball->angle < 45) drive->prepareDrive(0, 75, 0);
|
2019-12-05 13:31:21 +01:00
|
|
|
/* else if(ball->angle >= 45 && ball->angle <= 60) drive->drive(ball->angle, 75, 0);
|
2019-12-05 11:50:58 +01:00
|
|
|
else if(ball->angle > 60 && ball->angle < 90) drive->drive(ball->angle, 75, 0);
|
2019-12-05 13:31:21 +01:00
|
|
|
else if(ball->angle >= 90 && ball->angle < 135) drive->drive(ball->angle, 75, 0); */
|
2019-12-05 11:50:58 +01:00
|
|
|
} else {
|
|
|
|
drive->prepareDrive(0, 0, 0);
|
|
|
|
drive->drive(0, 0, 0);
|
2019-12-05 13:31:21 +01:00
|
|
|
}
|
|
|
|
}
|
2019-12-05 11:50:58 +01:00
|
|
|
|
|
|
|
void Goalie::ballBack(){
|
2019-12-05 13:31:21 +01:00
|
|
|
/* old int ballangle2;
|
2019-12-05 12:53:14 +01:00
|
|
|
int dir;
|
|
|
|
int plusang;
|
2019-12-05 11:50:58 +01:00
|
|
|
|
2019-12-05 12:53:14 +01:00
|
|
|
if(ball->distance > 130) plusang = GOALIE_ATKDIR_PLUSANGBAK;
|
|
|
|
else plusang = 0;
|
|
|
|
|
|
|
|
if(ball->angle > 180) ballangle2 = ball->angle - 360;
|
|
|
|
else ballangle2 = ball->angle;
|
|
|
|
if(ballangle2 > 0) dir = ball->angle + plusang; //45 con 8 ruote
|
|
|
|
else dir = ball->angle - plusang; //45 con 8 ruote
|
|
|
|
if(dir < 0) dir = dir + 360;
|
|
|
|
else dir = dir;
|
2019-12-05 13:31:21 +01:00
|
|
|
atk_direction = dir; */
|
2019-12-05 11:50:58 +01:00
|
|
|
}
|