even better pass and shoot
parent
fa005584d9
commit
297502ea70
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
//Camera goal: those setpoints correspond to the position of the center of the goal on the field
|
//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_X 0
|
||||||
#define CAMERA_GOAL_Y -14
|
#define CAMERA_GOAL_Y -12
|
||||||
|
|
||||||
#define CAMERA_GOAL_MIN_X -16
|
#define CAMERA_GOAL_MIN_X -8
|
||||||
#define CAMERA_GOAL_MAX_X 16
|
#define CAMERA_GOAL_MAX_X 8
|
||||||
|
|
||||||
#define CAMERA_CENTER_Y_ABS_SUM 60
|
#define CAMERA_CENTER_Y_ABS_SUM 60
|
||||||
//Actually it's ± MAX_VAL
|
//Actually it's ± MAX_VAL
|
||||||
|
|
|
@ -29,20 +29,31 @@ void PassAndShoot::init()
|
||||||
pass_counter = millis();
|
pass_counter = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long pass_timer = 0;
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
void PassAndShoot::realPlay()
|
void PassAndShoot::realPlay()
|
||||||
{
|
{
|
||||||
if (CURRENT_DATA_READ.ballSeen){
|
if (CURRENT_DATA_READ.ballSeen){
|
||||||
if(robot_indentifier == HIGH){
|
if(robot_indentifier == HIGH){
|
||||||
if(millis() - pass_counter <= 1500) {
|
if(ball->isInFront() && CURRENT_DATA_READ.ballDistance <= 90){
|
||||||
striker();
|
if(!flag){
|
||||||
}else{
|
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);
|
((PositionSysCamera*)ps)->setMoveSetpoints(CAMERA_GOAL_MIN_X, CAMERA_GOAL_Y);
|
||||||
bt->tosend = 'C';
|
bt->tosend = 'C';
|
||||||
}
|
roller->speed(0);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if(bt->received == 'C'){
|
if(bt->received == 'C'){
|
||||||
// //Show on 32u4
|
|
||||||
Serial2.write(0b00000100);
|
|
||||||
striker();
|
striker();
|
||||||
}else drive->prepareDrive(0,0,0);
|
}else drive->prepareDrive(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue