2019-11-18 18:11:26 +01:00
|
|
|
#pragma once
|
2020-02-18 09:37:36 +01:00
|
|
|
|
2022-07-03 12:52:04 +02:00
|
|
|
#include <Arduino.h>
|
2020-02-29 22:10:53 +01:00
|
|
|
#include "behaviour_control/data_source.h"
|
2021-04-19 19:16:31 +02:00
|
|
|
#include "behaviour_control/complementary_filter.h"
|
2020-02-18 09:37:36 +01:00
|
|
|
|
2019-11-18 17:15:32 +01:00
|
|
|
|
2022-07-05 12:01:19 +02:00
|
|
|
#define FILTER_DEFAULT_COEFF 0.85
|
2022-07-03 12:52:04 +02:00
|
|
|
#define FILTER_YANGLE_COEFF FILTER_DEFAULT_COEFF
|
|
|
|
#define FILTER_BANGLE_COEFF FILTER_DEFAULT_COEFF
|
|
|
|
#define FILTER_YANGLE_FIX_COEFF FILTER_DEFAULT_COEFF
|
|
|
|
#define FILTER_BANGLE_FIX_COEFF FILTER_DEFAULT_COEFF
|
|
|
|
#define FILTER_YDIST_COEFF FILTER_DEFAULT_COEFF
|
|
|
|
#define FILTER_BDIST_COEFF FILTER_DEFAULT_COEFF
|
2021-05-11 15:20:20 +02:00
|
|
|
|
2020-01-29 18:56:49 +01:00
|
|
|
class DataSourceCameraConic : public DataSource{
|
2019-11-18 17:15:32 +01:00
|
|
|
|
|
|
|
public:
|
2020-01-29 18:56:49 +01:00
|
|
|
DataSourceCameraConic(HardwareSerial* ser, int baud);
|
2019-11-18 17:15:32 +01:00
|
|
|
void test() override;
|
2019-11-18 18:11:26 +01:00
|
|
|
void readSensor() override;
|
2020-03-09 17:10:22 +01:00
|
|
|
void computeCoordsAngles();
|
2020-02-18 09:37:36 +01:00
|
|
|
// int getValueAtk(bool);
|
|
|
|
// int getValueDef(bool);
|
2020-01-20 18:43:51 +01:00
|
|
|
|
2022-07-03 12:52:04 +02:00
|
|
|
int count = 0, unkn_counter = 0;
|
|
|
|
bool data_received = false, start = false, end = false, dash = false;
|
|
|
|
char current_char = 'a', start_char = 'a', end_char = 'a'; //initialize to unused values
|
2020-01-20 18:43:51 +01:00
|
|
|
|
2021-05-07 21:39:03 +02:00
|
|
|
int goalOrientation, old_goalOrientation, pAtk, pDef;
|
2022-07-03 12:52:04 +02:00
|
|
|
String s1 = "", s2 = "";
|
|
|
|
|
|
|
|
int yangle = 0, bangle = 0, yangle_fix = 0, bangle_fix = 0, ydist = 0, bdist = 0;
|
|
|
|
ComplementaryFilter *filt_yangle, *filt_bangle, *filt_yangle_fix, *filt_bangle_fix, *filt_ydist, *filt_bdist;
|
2021-04-19 19:16:31 +02:00
|
|
|
|
2019-11-18 17:15:32 +01:00
|
|
|
};
|