From 0d5ce9576cf3cb432630a54cb9d50e776c4ab845 Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Mon, 17 Feb 2020 19:47:51 +0100 Subject: [PATCH] Now using Flavio's PID Library, plays flawlessly --- include/positionsys_zone.h | 2 +- include/vars.h | 2 +- src/main.cpp | 4 ---- src/positionsys_zone.cpp | 4 ++-- utility/OpenMV/conic_eff.py.autosave | 6 +++--- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/positionsys_zone.h b/include/positionsys_zone.h index 1dc99f0..71d736f 100644 --- a/include/positionsys_zone.h +++ b/include/positionsys_zone.h @@ -56,7 +56,7 @@ #define SOUTH_EAST 9 #define CAMERA_CENTER_X 3 -#define CAMERA_CENTER_Y 10 +#define CAMERA_CENTER_Y 6 class PositionSysZone : public PositionSystem{ public: diff --git a/include/vars.h b/include/vars.h index e8fec13..560cb30 100755 --- a/include/vars.h +++ b/include/vars.h @@ -1,5 +1,5 @@ #pragma once -#define DEBUG Serial +#define DEBUG Serial3 #define LED_R 20 #define LED_Y 17 diff --git a/src/main.cpp b/src/main.cpp index b5cde04..50ea14e 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,11 +23,7 @@ void loop() { goalie->play(role==1); keeper->play(role==0); - camera->test(); - - // Last thing to do: movement and update status vector - drive->drivePrepared(); updateStatusVector(); } diff --git a/src/positionsys_zone.cpp b/src/positionsys_zone.cpp index 84c0baf..c763411 100644 --- a/src/positionsys_zone.cpp +++ b/src/positionsys_zone.cpp @@ -373,8 +373,8 @@ void PositionSysZone::testLogicZone(){ void PositionSysZone::goCenter() { - if((camera->true_yb + camera->true_yy) >= 0) drive->prepareDrive(180, 75, 0); - else if ((camera->true_yb + camera->true_yy) <= -CAMERA_CENTER_Y) drive->prepareDrive(0, 75, 0); + if((camera->true_yb + camera->true_yy) > CAMERA_CENTER_Y) drive->prepareDrive(180, 75, 0); + else if ((camera->true_yb + camera->true_yy) < CAMERA_CENTER_Y) drive->prepareDrive(0, 75, 0); else drive->prepareDrive(0, 0, 0); /* if(camera->true_xb < -CAMERA_CENTER_X || camera->true_xy < -CAMERA_CENTER_X) drive->prepareDrive(90, 75, 0); else if(camera->true_xb > CAMERA_CENTER_X || camera->true_xy > CAMERA_CENTER_X) drive->prepareDrive(270, 75, 0); diff --git a/utility/OpenMV/conic_eff.py.autosave b/utility/OpenMV/conic_eff.py.autosave index 01dc8c7..05cb677 100644 --- a/utility/OpenMV/conic_eff.py.autosave +++ b/utility/OpenMV/conic_eff.py.autosave @@ -31,7 +31,7 @@ def val_map(x, in_min, in_max, out_min, out_max): red_led = pyb.LED(1) green_led = pyb.LED(2) blue_led = pyb.LED(3) - + red_led.off() green_led.off() blue_led.on() @@ -39,8 +39,8 @@ blue_led.on() -thresholds = [ (30, 70, -12, 19, 10, 57), # thresholds yellow goal - (0, 44, -5, 42, -65, -13)] # thresholds blue goal (6, 31, -15, 4, -35, 0) +thresholds = [ (0, 99, -16, 19, 13, 85), # thresholds yellow goal + (26, 52, -8, 19, -49, -18)] # thresholds blue goal (6, 31, -15, 4, -35, 0) roi = (0, 6, 318, 152)