From da1af0c7bc0c7b5d9d576e7729e9693d3d105453 Mon Sep 17 00:00:00 2001 From: emamaker Date: Mon, 16 May 2022 20:39:56 +0200 Subject: [PATCH] remove ball presence sensor as it will not be present on robot for the time being --- include/sensors/data_source_ball_presence.h | 18 ------------- include/sensors/sensors.h | 2 -- src/sensors/data_source_ball_presence.cpp | 29 --------------------- src/sensors/sensors.cpp | 5 ++-- src/test_menu.cpp | 2 +- 5 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 include/sensors/data_source_ball_presence.h delete mode 100644 src/sensors/data_source_ball_presence.cpp diff --git a/include/sensors/data_source_ball_presence.h b/include/sensors/data_source_ball_presence.h deleted file mode 100644 index d90a55d..0000000 --- a/include/sensors/data_source_ball_presence.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#define BALL_PRESENCE_TRESH 600 - -#include -#include "behaviour_control/data_source.h" - -class DataSourceBallPresence : public DataSource{ - - public: - DataSourceBallPresence(int, bool); - void postProcess() override; - void test() override; - bool isInMouth(); - - public: - bool present; -}; \ No newline at end of file diff --git a/include/sensors/sensors.h b/include/sensors/sensors.h index a144e98..68b50cd 100644 --- a/include/sensors/sensors.h +++ b/include/sensors/sensors.h @@ -17,7 +17,6 @@ #include "systems/lines/linesys_camera.h" #include "systems/position/positionsys_zone.h" #include "sensors/data_source_ball.h" -#include "sensors/data_source_ball_presence.h" #include "sensors/data_source_bt.h" #include "sensors/data_source_bno055.h" #include "sensors/data_source_camera_conicmirror.h" @@ -36,7 +35,6 @@ s_extr DataSourceBall* ball; s_extr DataSourceCameraConic* camera; s_extr DriveController* drive; s_extr DataSourceBT* bt; -s_extr DataSourceBallPresence* ballPresence; s_extr int role; diff --git a/src/sensors/data_source_ball_presence.cpp b/src/sensors/data_source_ball_presence.cpp deleted file mode 100644 index ffcb2cd..0000000 --- a/src/sensors/data_source_ball_presence.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "sensors/data_source_ball_presence.h" -#include "behaviour_control/status_vector.h" -#include "vars.h" - -DataSourceBallPresence::DataSourceBallPresence(int pin_, bool analog) : DataSource(pin_, analog){ - present = false; - value = 0; -} - -void DataSourceBallPresence::postProcess(){ - present = value <= BALL_PRESENCE_TRESH; - - CURRENT_INPUT_WRITE.ballPresenceVal = value; - CURRENT_DATA_WRITE.ballPresenceVal = value; - CURRENT_DATA_WRITE.ballPresent = present; -} - -bool DataSourceBallPresence::isInMouth(){ - return ball->isInFront() && present; -} - -void DataSourceBallPresence::test(){ - DEBUG.print("Reading value: "); - DEBUG.print(CURRENT_DATA_READ.ballPresenceVal); - DEBUG.print(" -> "); - DEBUG.print(CURRENT_DATA_READ.ballPresent); - DEBUG.print(" | Ball in mouth: "); - DEBUG.println(isInMouth()); -} \ No newline at end of file diff --git a/src/sensors/sensors.cpp b/src/sensors/sensors.cpp index b6c962e..ea841f7 100644 --- a/src/sensors/sensors.cpp +++ b/src/sensors/sensors.cpp @@ -26,10 +26,9 @@ void updateSensors(){ compass->update(); ball->update(); - ballPresence->update(); + camera->update(); - bt->update(); - // roller->update(); + roller->update(); } \ No newline at end of file diff --git a/src/test_menu.cpp b/src/test_menu.cpp index d2bc309..17c393b 100644 --- a/src/test_menu.cpp +++ b/src/test_menu.cpp @@ -110,7 +110,7 @@ void TestMenu::testMenu() DEBUG.print((char)Serial2.read()); break; case 'b': - ballPresence->test(); + // ballPresence->test(); break; case 'r': drive->stopAll();