From 0aeb92ac2797ae6366d239ba0222feacca5444d9 Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Mon, 1 Mar 2021 19:00:45 +0100 Subject: [PATCH] positionsys camera: introduce an easy way to counter act bad mirror positioning This allows to define each point relative to the absolute center of the field shifting each Move Setpoint by a defined user-calibrated amount --- include/systems/position/positionsys_camera.h | 10 +++++++--- src/system/positions/positionsys_camera.cpp | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/systems/position/positionsys_camera.h b/include/systems/position/positionsys_camera.h index ade806d..d8f662e 100644 --- a/include/systems/position/positionsys_camera.h +++ b/include/systems/position/positionsys_camera.h @@ -2,10 +2,14 @@ #include "systems/systems.h" -//Note: those variables can be changes, and will need to change depending on camera calibration +/*Camera translation: because of mechanical imprecision, the center of the camera and the center of the cone mirror may not coincide +To overcome this, each coordinate needs to be shifted by some amount, defined on a per-robot basis that needs to be recalibrated each time. +These values need to be subtracted from the coords used in setMoveSetpoints*/ +#define CAMERA_TRANSLATION_X 0 +#define CAMERA_TRANSLATION_Y 12 -//Camera center: those setpoints correspond to the center of the field -#define CAMERA_CENTER_X -0 +//Camera center: those setpoints correspond to what we consider the center of the field +#define CAMERA_CENTER_X 0 #define CAMERA_CENTER_Y 0 //Camera goal: those setpoints correspond to the position of the center of the goal on the field diff --git a/src/system/positions/positionsys_camera.cpp b/src/system/positions/positionsys_camera.cpp index d4892fc..a6abd8c 100644 --- a/src/system/positions/positionsys_camera.cpp +++ b/src/system/positions/positionsys_camera.cpp @@ -67,8 +67,8 @@ void PositionSysCamera::update(){ //This means the last time this is called has the biggest priority, has for prepareDrive void PositionSysCamera::setMoveSetpoints(int x, int y){ - Setpointx = x; - Setpointy = y; + Setpointx = x + CAMERA_TRANSLATION_X; + Setpointy = y + CAMERA_TRANSLATION_Y; givenMovement = true; CameraPID(); }