2021-03-22 14:03:53 +01:00
|
|
|
#pragma once
|
2020-02-29 22:10:53 +01:00
|
|
|
|
2021-03-22 14:03:53 +01:00
|
|
|
#include "PID_v2.h"
|
2020-11-04 17:46:14 +01:00
|
|
|
#include "systems/systems.h"
|
2021-04-14 15:00:43 +02:00
|
|
|
#include "behaviour_control/complementary_filter.h"
|
2021-05-10 20:34:20 +02:00
|
|
|
#include "behaviour_control/status_vector.h"
|
2020-02-21 13:37:32 +01:00
|
|
|
|
2021-03-01 19:00:45 +01:00
|
|
|
//Camera center: those setpoints correspond to what we consider the center of the field
|
|
|
|
#define CAMERA_CENTER_X 0
|
2021-03-01 16:00:48 +01:00
|
|
|
#define CAMERA_CENTER_Y 0
|
2020-10-31 15:37:38 +01:00
|
|
|
|
|
|
|
//Camera goal: those setpoints correspond to the position of the center of the goal on the field
|
2021-03-22 14:03:53 +01:00
|
|
|
#define CAMERA_GOAL_X 0
|
2021-04-14 15:00:43 +02:00
|
|
|
#define CAMERA_GOAL_Y -14
|
2020-10-31 15:37:38 +01:00
|
|
|
|
2021-04-14 15:00:43 +02:00
|
|
|
#define CAMERA_GOAL_MIN_X -16
|
|
|
|
#define CAMERA_GOAL_MAX_X 16
|
2021-02-22 18:43:43 +01:00
|
|
|
|
|
|
|
#define CAMERA_CENTER_Y_ABS_SUM 60
|
2020-02-28 16:45:28 +01:00
|
|
|
//Actually it's ± MAX_VAL
|
2021-01-31 18:41:27 +01:00
|
|
|
#define MAX_X 50
|
2020-02-28 16:45:28 +01:00
|
|
|
#define MAX_Y (CAMERA_CENTER_Y_ABS_SUM/2)
|
2021-04-19 19:16:31 +02:00
|
|
|
#define DIST_MULT 1.7
|
2020-02-26 18:51:46 +01:00
|
|
|
|
|
|
|
#define Kpx 1
|
|
|
|
#define Kix 0
|
|
|
|
#define Kdx 0
|
|
|
|
#define Kpy 1
|
|
|
|
#define Kiy 0
|
|
|
|
#define Kdy 0
|
2020-02-21 13:37:32 +01:00
|
|
|
|
|
|
|
class PositionSysCamera : public PositionSystem{
|
|
|
|
|
|
|
|
public:
|
|
|
|
PositionSysCamera();
|
2020-12-23 21:16:50 +01:00
|
|
|
void goCenter() override;
|
|
|
|
void centerGoal() override;
|
2020-03-12 12:09:13 +01:00
|
|
|
void setMoveSetpoints(int x, int y);
|
|
|
|
void addMoveOnAxis(int x, int y);
|
2020-02-21 13:37:32 +01:00
|
|
|
void update() override;
|
|
|
|
void test() override;
|
2020-02-26 18:51:46 +01:00
|
|
|
void setCameraPID();
|
|
|
|
void CameraPID();
|
2020-02-27 17:30:10 +01:00
|
|
|
int calcOtherGoalY(int goalY);
|
2020-02-26 18:51:46 +01:00
|
|
|
|
|
|
|
double Inputx, Outputx, Setpointx, Inputy, Outputy, Setpointy;
|
2020-03-12 12:09:13 +01:00
|
|
|
int MAX_DIST, vx, vy, axisx, axisy;
|
|
|
|
bool givenMovement;
|
2020-02-26 18:51:46 +01:00
|
|
|
PID* X;
|
|
|
|
PID* Y;
|
2021-04-14 15:00:43 +02:00
|
|
|
ComplementaryFilter* filterDir;
|
|
|
|
ComplementaryFilter* filterSpeed;
|
2020-02-21 13:37:32 +01:00
|
|
|
|
2021-05-10 20:34:20 +02:00
|
|
|
data valid_data;
|
|
|
|
|
2020-02-21 13:37:32 +01:00
|
|
|
};
|