even better pass and shoot

pull/1/head
EmaMaker 2021-05-14 10:42:33 +02:00
parent fa005584d9
commit 297502ea70
2 changed files with 20 additions and 9 deletions

View File

@ -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

View File

@ -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);
}