new goalie c:

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

View File

@ -6,7 +6,7 @@
void setup() {
delay(500);
DEBUG.begin(9600);
DEBUG.begin(19600);
initSensors();
initGames();
@ -16,6 +16,7 @@ void setup() {
void loop() {
updateSensors();
<<<<<<< HEAD
//camera->test();
goalie->play(role==1);
keeper->play(role==0);
@ -25,4 +26,14 @@ void loop() {
// Last thing to do: movement
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
(20, 51, -23, 26, -69, -31)] # thresholds blue goal (6, 31, -15, 4, -35, 0)
thresholds = [ (60, 75, -19, 9, 9, 60), # thresholds yellow goal
(16, 35, -8, 24, -41, -13)] # thresholds blue goal (6, 31, -15, 4, -35, 0)
roi = (0, 6, 318, 152)
@ -64,7 +64,7 @@ sensor.set_contrast(+0)
sensor.set_saturation(+0)
sensor.set_brightness(0)
sensor.set_quality(0)
sensor.set_auto_exposure(False, 8000)
sensor.set_auto_exposure(False, 3500)
sensor.set_auto_gain(True)
sensor.skip_frames(time = 300)
@ -125,7 +125,7 @@ while(True):
if b_found == True:
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
s_bcx = chr(b_cx)
@ -139,6 +139,7 @@ while(True):
#print(str(y_cx) + " | " + str(y_cy) + " --- " + str(b_cx) + " | " + str(b_cy))
uart.write(START_BYTE)
uart.write(s_ycx)
uart.write(s_ycy)