Now using Flavio's PID Library, plays flawlessly

pull/1/head
EmaMaker 2020-02-17 19:47:51 +01:00
parent 75711e6f28
commit 0d5ce9576c
5 changed files with 7 additions and 11 deletions

View File

@ -56,7 +56,7 @@
#define SOUTH_EAST 9 #define SOUTH_EAST 9
#define CAMERA_CENTER_X 3 #define CAMERA_CENTER_X 3
#define CAMERA_CENTER_Y 10 #define CAMERA_CENTER_Y 6
class PositionSysZone : public PositionSystem{ class PositionSysZone : public PositionSystem{
public: public:

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#define DEBUG Serial #define DEBUG Serial3
#define LED_R 20 #define LED_R 20
#define LED_Y 17 #define LED_Y 17

View File

@ -23,11 +23,7 @@ void loop() {
goalie->play(role==1); goalie->play(role==1);
keeper->play(role==0); keeper->play(role==0);
camera->test();
// Last thing to do: movement and update status vector // Last thing to do: movement and update status vector
drive->drivePrepared(); drive->drivePrepared();
updateStatusVector(); updateStatusVector();
} }

View File

@ -373,8 +373,8 @@ void PositionSysZone::testLogicZone(){
void PositionSysZone::goCenter() { void PositionSysZone::goCenter() {
if((camera->true_yb + camera->true_yy) >= 0) drive->prepareDrive(180, 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 if ((camera->true_yb + camera->true_yy) < CAMERA_CENTER_Y) drive->prepareDrive(0, 75, 0);
else drive->prepareDrive(0, 0, 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); /* 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); else if(camera->true_xb > CAMERA_CENTER_X || camera->true_xy > CAMERA_CENTER_X) drive->prepareDrive(270, 75, 0);

View File

@ -31,7 +31,7 @@ def val_map(x, in_min, in_max, out_min, out_max):
red_led = pyb.LED(1) red_led = pyb.LED(1)
green_led = pyb.LED(2) green_led = pyb.LED(2)
blue_led = pyb.LED(3) blue_led = pyb.LED(3)
red_led.off() red_led.off()
green_led.off() green_led.off()
blue_led.on() blue_led.on()
@ -39,8 +39,8 @@ blue_led.on()
thresholds = [ (30, 70, -12, 19, 10, 57), # thresholds yellow goal thresholds = [ (0, 99, -16, 19, 13, 85), # thresholds yellow goal
(0, 44, -5, 42, -65, -13)] # thresholds blue goal (6, 31, -15, 4, -35, 0) (26, 52, -8, 19, -49, -18)] # thresholds blue goal (6, 31, -15, 4, -35, 0)
roi = (0, 6, 318, 152) roi = (0, 6, 318, 152)