From 7deaeff7c035e09576d7353a06be59c1233937b2 Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Mon, 1 Mar 2021 18:35:54 +0100 Subject: [PATCH] holon movement: recalculate max possible velocity The velocity has been calculated by using the holon movement formulas in an excel spritesheetand and empirically tested to find a suitable value --- include/motors_movement/drivecontroller.h | 6 ++++++ src/strategy_roles/striker.cpp | 2 +- src/system/positions/positionsys_camera.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/motors_movement/drivecontroller.h b/include/motors_movement/drivecontroller.h index eff642d..d3793e2 100644 --- a/include/motors_movement/drivecontroller.h +++ b/include/motors_movement/drivecontroller.h @@ -18,6 +18,12 @@ #define UNLOCK_THRESH 800 +#define MAX_VEL 310 +#define MAX_VEL_EIGTH 248 +#define MAX_VEL_HALF 155 +#define MAX_VEL_3QUARTERS 232 +#define MAX_VEL_QUARTER 78 + class DriveController{ public: diff --git a/src/strategy_roles/striker.cpp b/src/strategy_roles/striker.cpp index d7f0f51..3f0d6f3 100644 --- a/src/strategy_roles/striker.cpp +++ b/src/strategy_roles/striker.cpp @@ -58,7 +58,7 @@ void Striker::striker() dir = dir + 360; //se sto nel quadrante negativo ricappotto else dir = dir; - drive->prepareDrive(dir, 100, 0); + drive->prepareDrive(dir, MAX_VEL_EIGTH, 0); } void Striker::storcimentoPorta() diff --git a/src/system/positions/positionsys_camera.cpp b/src/system/positions/positionsys_camera.cpp index 253cb6a..d4892fc 100644 --- a/src/system/positions/positionsys_camera.cpp +++ b/src/system/positions/positionsys_camera.cpp @@ -118,7 +118,7 @@ void PositionSysCamera::CameraPID(){ dir = (dir+360) % 360; int dist = sqrt(Outputx*Outputx + Outputy*Outputy); - int speed = map(dist*DIST_MULT, 0, MAX_DIST, 0, 350); + int speed = map(dist*DIST_MULT, 0, MAX_DIST, 0, MAX_VEL); drive->prepareDrive(dir, speed, 0);