new goalie c:

pull/1/head
u-siri-ous 2020-01-22 18:52:13 +01:00
commit a9d9bc7928
3 changed files with 23 additions and 14 deletions

View File

@ -12,16 +12,20 @@ void DataSourceCamera :: readSensor(){
count=0; count=0;
} }
else if(value==endp){ else if(value==endp){
end=true;
start=false;
data_received=false; data_received=false;
<<<<<<< HEAD
if(count=4 && start==true) { if(count=4 && start==true) {
=======
if(count==4 && start==true) {
>>>>>>> d534c5b4a8c2064cb43c42f9269b7f0256894ef8
data_received=true; data_received=true;
true_xb = xb; true_xb = xb;
true_yb = yb; true_yb = yb;
true_xy = xy; true_xy = xy;
true_yy = yy; true_yy = yy;
} }
end=true;
start=false;
}else{ }else{
if(start==true){ if(start==true){
if (count==0) xb=value; if (count==0) xb=value;
@ -186,13 +190,6 @@ void DataSourceCamera::test(){
DEBUG.print(" | "); DEBUG.print(" | ");
DEBUG.println(fixCamIMU(pDef)); */ DEBUG.println(fixCamIMU(pDef)); */
//update(); //update();
DEBUG.print(xb);
DEBUG.print("|");
DEBUG.print(yb);
DEBUG.print("|");
DEBUG.print(xy);
DEBUG.print("|");
DEBUG.print(yy);
DEBUG.println("---------------"); DEBUG.println("---------------");
DEBUG.print(true_xb); DEBUG.print(true_xb);
DEBUG.print("|"); DEBUG.print("|");

View File

@ -6,7 +6,7 @@
void setup() { void setup() {
delay(500); delay(500);
DEBUG.begin(9600); DEBUG.begin(19600);
initSensors(); initSensors();
initGames(); initGames();
@ -16,6 +16,7 @@ void setup() {
void loop() { void loop() {
updateSensors(); updateSensors();
<<<<<<< HEAD
//camera->test(); //camera->test();
goalie->play(role==1); goalie->play(role==1);
keeper->play(role==0); keeper->play(role==0);
@ -25,4 +26,14 @@ void loop() {
// Last thing to do: movement // Last thing to do: movement
drive->drivePrepared(); drive->drivePrepared();
=======
// goalie->play(role==1);
// keeper->play(role==0);
// Last thing to do: movement
// drive->drivePrepared();
//Serial.print("ao");
camera->test();
>>>>>>> d534c5b4a8c2064cb43c42f9269b7f0256894ef8
} }

View File

@ -39,8 +39,8 @@ blue_led.on()
thresholds = [ (69, 100, -12, 11, 15, 89), # thresholds yellow goal thresholds = [ (60, 75, -19, 9, 9, 60), # thresholds yellow goal
(20, 51, -23, 26, -69, -31)] # thresholds blue goal (6, 31, -15, 4, -35, 0) (16, 35, -8, 24, -41, -13)] # thresholds blue goal (6, 31, -15, 4, -35, 0)
roi = (0, 6, 318, 152) roi = (0, 6, 318, 152)
@ -64,7 +64,7 @@ sensor.set_contrast(+0)
sensor.set_saturation(+0) sensor.set_saturation(+0)
sensor.set_brightness(0) sensor.set_brightness(0)
sensor.set_quality(0) sensor.set_quality(0)
sensor.set_auto_exposure(False, 8000) sensor.set_auto_exposure(False, 3500)
sensor.set_auto_gain(True) sensor.set_auto_gain(True)
sensor.skip_frames(time = 300) sensor.skip_frames(time = 300)
@ -125,7 +125,7 @@ while(True):
if b_found == True: if b_found == True:
b_cx = val_map(b_cx, -img.width() / 2, img.width() / 2, 0, 100) b_cx = val_map(b_cx, -img.width() / 2, img.width() / 2, 0, 100)
b_cx = val_map(b_cy, -img.height() / 2, img.height() / 2, 0, 100) b_cy = val_map(b_cy, -img.height() / 2, img.height() / 2, 0, 100)
#Prepare for send as a list of characters #Prepare for send as a list of characters
s_bcx = chr(b_cx) s_bcx = chr(b_cx)
@ -139,6 +139,7 @@ while(True):
#print(str(y_cx) + " | " + str(y_cy) + " --- " + str(b_cx) + " | " + str(b_cy)) #print(str(y_cx) + " | " + str(y_cy) + " --- " + str(b_cx) + " | " + str(b_cy))
uart.write(START_BYTE) uart.write(START_BYTE)
uart.write(s_ycx) uart.write(s_ycx)
uart.write(s_ycy) uart.write(s_ycy)