From c6856fdbcec3620ede8616fb082627e9eed207d9 Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Thu, 5 Dec 2019 14:29:16 +0100 Subject: [PATCH] fixed something left by u-siri-ous --- src/goalie.cpp | 2 +- src/main.cpp | 87 +++----------------------------------------------- 2 files changed, 5 insertions(+), 84 deletions(-) diff --git a/src/goalie.cpp b/src/goalie.cpp index 81dee90..2417f5f 100644 --- a/src/goalie.cpp +++ b/src/goalie.cpp @@ -5,7 +5,7 @@ Goalie::Goalie(){ } void Goalie::goalie(){ digitalWrite(LED_G, HIGH); if(ball->ballSeen){ - if(ball->angle >= 0 && ball->angle < 45) drive->drive(0, 75, 0); + if(ball->angle >= 0 && ball->angle < 45) drive->prepareDrive(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); */ diff --git a/src/main.cpp b/src/main.cpp index 4e9e63f..180c412 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,89 +13,10 @@ void setup() { void loop() { updateSensors(); - /* Trial trial; - trial.trial(); */ - //drive->prepareDrive(0,0,0); - linesCtrl->update(); + goalie->goalie(); - //drive->drivePrepared(); + linesCtrl->update(); + // Last thing to do: movement + drive->drivePrepared(); } - - -/*old function trial - class Trial{ - public: - void trial(){ - digitalWrite(LED_Y, LOW); - if(ball->angle >= 350 || ball->angle <= 10) { - if(ball->distance > 190) goalie->atk_direction = 0; - else goalie->atk_direction = ball->angle; - goalie->atk_speed = GOALIE_ATKSPD_FRT; - } - - if(ball->angle >= 90 && ball->angle <= 270) { - goalie->ballBack(); - goalie->atk_speed = GOALIE_ATKSPD_BAK; - } - if(digitalRead(SWITCH_DX) == 1) { - if(ball->angle > 10 && ball->angle < 30) { - goalie->atk_direction = ball->angle + GOALIE_ATKDIR_PLUSANG1; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle >= 30 && ball->angle < 45) { - goalie->atk_direction = ball->angle + GOALIE_ATKDIR_PLUSANG2; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle >= 45 && ball->angle < 90) { - goalie->atk_direction = ball->angle + GOALIE_ATKDIR_PLUSANG3; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle > 270 && ball->angle <= 315) { - goalie->atk_direction = ball->angle - GOALIE_ATKDIR_PLUSANG3_COR; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle > 315 && ball->angle <= 330) { - goalie->atk_direction = ball->angle - GOALIE_ATKDIR_PLUSANG2_COR; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle > 330 && ball->angle < 350) { - goalie->atk_direction = ball->angle - GOALIE_ATKDIR_PLUSANG1_COR; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - } else { - if(ball->angle > 10 && ball->angle < 30) { - goalie->atk_direction = ball->angle + GOALIE_ATKDIR_PLUSANG1_COR; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle >= 30 && ball->angle < 45) { - goalie->atk_direction = ball->angle + GOALIE_ATKDIR_PLUSANG2_COR; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle >= 45 && ball->angle < 90) { - goalie->atk_direction = ball->angle + GOALIE_ATKDIR_PLUSANG3_COR; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle > 270 && ball->angle <= 315) { - goalie->atk_direction = ball->angle - GOALIE_ATKDIR_PLUSANG3; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle > 315 && ball->angle <= 330) { - goalie->atk_direction = ball->angle - GOALIE_ATKDIR_PLUSANG2; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - if(ball->angle > 330 && ball->angle < 350) { - goalie->atk_direction = ball->angle - GOALIE_ATKDIR_PLUSANG1; - goalie->atk_speed = GOALIE_ATKSPD_LAT; - } - } - - if((ball->angle >= 330 || ball->angle <= 30) && ball->distance > 190) { //storcimento - goalie->atk_speed = GOALIE_ATKSPD_STRK; //dove i gigahertz hanno fallito - drive->prepareDrive(goalie->atk_direction, goalie->atk_speed, 0); - } - else drive->prepareDrive(goalie->atk_direction, goalie->atk_speed, 0); -} - -}; */ -