SPQR-Team-2019-REVAMPED/src/goalie.cpp

33 lines
1.0 KiB
C++
Raw Normal View History

#include "goalie.h"
Goalie::Goalie(){ }
void Goalie::goalie(){
digitalWrite(LED_G, HIGH);
if(ball->ballSeen){
if(ball->angle >= 0 && ball->angle < 45) drive->drive(0, 75, 0);
/* else if(ball->angle >= 45 && ball->angle <= 60) drive->drive(ball->angle, 75, 0);
else if(ball->angle > 60 && ball->angle < 90) drive->drive(ball->angle, 75, 0);
else if(ball->angle >= 90 && ball->angle < 135) drive->drive(ball->angle, 75, 0); */
} else {
drive->prepareDrive(0, 0, 0);
drive->drive(0, 0, 0);
}
}
void Goalie::ballBack(){
/* old int ballangle2;
2019-12-05 12:53:14 +01:00
int dir;
int plusang;
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;
atk_direction = dir; */
}