diff --git a/include/systems/position/positionsys_camera.h b/include/systems/position/positionsys_camera.h index c997933..d9032cc 100644 --- a/include/systems/position/positionsys_camera.h +++ b/include/systems/position/positionsys_camera.h @@ -11,10 +11,10 @@ //Camera goal: those setpoints correspond to the position of the center of the goal on the field #define CAMERA_GOAL_X 0 -#define CAMERA_GOAL_Y -14 +#define CAMERA_GOAL_Y -12 -#define CAMERA_GOAL_MIN_X -16 -#define CAMERA_GOAL_MAX_X 16 +#define CAMERA_GOAL_MIN_X -8 +#define CAMERA_GOAL_MAX_X 8 #define CAMERA_CENTER_Y_ABS_SUM 60 //Actually it's ± MAX_VAL diff --git a/src/strategy_roles/pass_and_shoot.cpp b/src/strategy_roles/pass_and_shoot.cpp index a65fbc3..65b4f8f 100644 --- a/src/strategy_roles/pass_and_shoot.cpp +++ b/src/strategy_roles/pass_and_shoot.cpp @@ -29,20 +29,31 @@ void PassAndShoot::init() pass_counter = millis(); } +unsigned long pass_timer = 0; +boolean flag = false; + void PassAndShoot::realPlay() { if (CURRENT_DATA_READ.ballSeen){ if(robot_indentifier == HIGH){ - if(millis() - pass_counter <= 1500) { - striker(); - }else{ + if(ball->isInFront() && CURRENT_DATA_READ.ballDistance <= 90){ + if(!flag){ + pass_timer = millis(); + flag = true; + + //Show on 32u4 + Serial2.write(0b00000100); + } + } + if(!flag || (millis() - pass_timer <= 650)){ + striker(); + }else{ ((PositionSysCamera*)ps)->setMoveSetpoints(CAMERA_GOAL_MIN_X, CAMERA_GOAL_Y); bt->tosend = 'C'; - } + roller->speed(0); + } }else{ if(bt->received == 'C'){ - // //Show on 32u4 - Serial2.write(0b00000100); striker(); }else drive->prepareDrive(0,0,0); }