2019-11-18 18:11:26 +01:00
|
|
|
#pragma once
|
2020-02-29 22:10:53 +01:00
|
|
|
#include "behaviour_control/data_source.h"
|
2021-05-07 21:39:03 +02:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
2022-06-28 10:39:35 +02:00
|
|
|
#define MOUTH_MIN_ANGLE 345
|
|
|
|
#define MOUTH_MAX_ANGLE 15
|
2021-05-28 20:53:35 +02:00
|
|
|
#define MOUTH_DISTANCE 100
|
2021-05-07 21:39:03 +02:00
|
|
|
#define MOUTH_MAX_DISTANCE 140
|
2019-11-18 14:42:43 +01:00
|
|
|
|
2022-07-03 13:15:09 +02:00
|
|
|
class DataSourceBall : public DataSource
|
|
|
|
{
|
2019-11-18 14:42:43 +01:00
|
|
|
|
2022-07-03 13:15:09 +02:00
|
|
|
public:
|
|
|
|
DataSourceBall(HardwareSerial *ser, int baud);
|
|
|
|
void readSensor() override;
|
|
|
|
void postProcess() override;
|
|
|
|
void test() override;
|
|
|
|
bool isInMouth();
|
|
|
|
bool isInMouthMaxDistance();
|
|
|
|
bool isInFront();
|
|
|
|
|
|
|
|
int angle = 0, distance = 0, angleFix = 0;
|
|
|
|
bool ballSeen = false;
|
|
|
|
};
|