recycle striker strategy from last year code

bad translation, goalie is actually a striker
pull/1/head
ema.coletta@gmail.com 2020-10-29 17:20:36 +01:00
parent 0f913d8ad1
commit 304610e2e2
2 changed files with 65 additions and 27 deletions

View File

@ -7,7 +7,7 @@
#define TILT_MULT 1.8 #define TILT_MULT 1.8
#define TILT_DIST 180 #define TILT_DIST 180
#define CATCH_DIST 150 #define CATCH_DIST 150
#define GOALIE_ATKSPD_LAT 255 #define GOALIE_ATKSPD_LAT 320 //255
#define GOALIE_ATKSPD_BAK 350 #define GOALIE_ATKSPD_BAK 350
#define GOALIE_ATKSPD_FRT 345 #define GOALIE_ATKSPD_FRT 345
#define GOALIE_ATKSPD_STRK 355 #define GOALIE_ATKSPD_STRK 355
@ -28,7 +28,7 @@ class Goalie : public Game, public PositionSysZone{
private: private:
void realPlay() override; void realPlay() override;
void init() override; void init() override;
void goalie(int); void goalie();
void ballBack(); void ballBack();
void storcimentoPorta(); void storcimentoPorta();

View File

@ -22,37 +22,75 @@ void Goalie::init(){
} }
void Goalie::realPlay(){ void Goalie::realPlay(){
if(ball->ballSeen) this->goalie(50); if(ball->ballSeen) this->goalie();
else ((PositionSysCamera*)ps)->goCenter(); else ((PositionSysCamera*)ps)->goCenter();
} }
int dir, degrees2; void Goalie::goalie() {
void Goalie::goalie(int plusang) { if(ball->angle>= 350 || ball->angle<= 20) {
if(ball->distance < CATCH_DIST) drive->prepareDrive(ball->angle, 350, 0); if(ball->distance > 190) atk_direction = 0;
else{ else atk_direction = ball->angle;
/* if(ball->angle > 345 || ball->angle < 15) plusang *= 0.15; atk_speed = GOALIE_ATKSPD_FRT;
FRONT */ }
if (ball->angle > 345 && ball->angle < 15) plusang *= 0.15;
if(ball->angle > 180) degrees2 = ball->angle - 360;
else degrees2 = ball->angle;
if(degrees2 > 0) dir = ball->angle + plusang; //45 con 8 ruote if(ball->angle>= 90 && ball->angle<= 270) {
else dir = ball->angle - plusang; //45 con 8 ruote ballBack();
atk_speed = GOALIE_ATKSPD_BAK;
}
if(ball->angle> 10 && ball->angle< 30) {
atk_direction = ball->angle+ GOALIE_ATKDIR_PLUSANG1;
atk_speed = GOALIE_ATKSPD_LAT;
}
if(ball->angle>= 30 && ball->angle< 45) {
atk_direction = ball->angle+ GOALIE_ATKDIR_PLUSANG2;
atk_speed = GOALIE_ATKSPD_LAT;
}
if(ball->angle>= 45 && ball->angle< 90) {
atk_direction = ball->angle+ GOALIE_ATKDIR_PLUSANG3;
atk_speed = GOALIE_ATKSPD_LAT;
}
if(ball->angle> 270 && ball->angle<= 315) {
atk_direction = ball->angle- GOALIE_ATKDIR_PLUSANG3_COR;
atk_speed = GOALIE_ATKSPD_LAT;
}
if(ball->angle> 315 && ball->angle<= 330) {
atk_direction = ball->angle- GOALIE_ATKDIR_PLUSANG2_COR;
atk_speed = GOALIE_ATKSPD_LAT;
}
if(ball->angle> 330 && ball->angle< 350) {
atk_direction = ball->angle- GOALIE_ATKDIR_PLUSANG1_COR;
atk_speed = GOALIE_ATKSPD_LAT;
}
// if((ball->angle>= 330 || ball->angle<= 30) && ball->distance > 190) { //storcimento
// atk_speed = GOALIE_ATKSPD_STRK; //dove i gigahertz hanno fallito
// drive->prepareDrive(atk_direction, atk_speed, cstorc);
// }
// else
drive->prepareDrive(atk_direction, 100);
}
void Goalie::ballBack() {
int ball_degrees2;
int dir;
int plusang;
if(ball->distance > 130) plusang = GOALIE_ATKDIR_PLUSANGBAK;
else plusang = 0;
if(ball->angle> 180) ball_degrees2 = ball->angle- 360;
else ball_degrees2 = ball->angle;
if(ball_degrees2 > 0) 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;
atk_direction = dir;
storcimentoPorta();
if(ball->distance > TILT_DIST && (ball->angle > 340 || ball->angle < 20)){
plusang -= 20;
drive->prepareDrive(dir, 350, cstorc);
} else {
drive->prepareDrive(dir, 350, 0);
cstorc = 0;
}
}
} }
void Goalie::storcimentoPorta() { void Goalie::storcimentoPorta() {
if (CURRENT_DATA_READ.angleAtkFix >= 5 && CURRENT_DATA_READ.angleAtkFix <= 60) cstorc+=9; if (CURRENT_DATA_READ.angleAtkFix >= 5 && CURRENT_DATA_READ.angleAtkFix <= 60) cstorc+=9;
else if (CURRENT_DATA_READ.angleAtkFix <= 355 && CURRENT_DATA_READ.angleAtkFix >= 210) cstorc-=9; else if (CURRENT_DATA_READ.angleAtkFix <= 355 && CURRENT_DATA_READ.angleAtkFix >= 210) cstorc-=9;