remove ball presence sensor
as it will not be present on robot for the time beingpull/1/head
parent
5587ab02b1
commit
da1af0c7bc
|
@ -1,18 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#define BALL_PRESENCE_TRESH 600
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#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;
|
|
||||||
};
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "systems/lines/linesys_camera.h"
|
#include "systems/lines/linesys_camera.h"
|
||||||
#include "systems/position/positionsys_zone.h"
|
#include "systems/position/positionsys_zone.h"
|
||||||
#include "sensors/data_source_ball.h"
|
#include "sensors/data_source_ball.h"
|
||||||
#include "sensors/data_source_ball_presence.h"
|
|
||||||
#include "sensors/data_source_bt.h"
|
#include "sensors/data_source_bt.h"
|
||||||
#include "sensors/data_source_bno055.h"
|
#include "sensors/data_source_bno055.h"
|
||||||
#include "sensors/data_source_camera_conicmirror.h"
|
#include "sensors/data_source_camera_conicmirror.h"
|
||||||
|
@ -36,7 +35,6 @@ s_extr DataSourceBall* ball;
|
||||||
s_extr DataSourceCameraConic* camera;
|
s_extr DataSourceCameraConic* camera;
|
||||||
s_extr DriveController* drive;
|
s_extr DriveController* drive;
|
||||||
s_extr DataSourceBT* bt;
|
s_extr DataSourceBT* bt;
|
||||||
s_extr DataSourceBallPresence* ballPresence;
|
|
||||||
|
|
||||||
s_extr int role;
|
s_extr int role;
|
||||||
|
|
||||||
|
|
|
@ -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());
|
|
||||||
}
|
|
|
@ -26,10 +26,9 @@ void updateSensors(){
|
||||||
|
|
||||||
compass->update();
|
compass->update();
|
||||||
ball->update();
|
ball->update();
|
||||||
ballPresence->update();
|
|
||||||
camera->update();
|
camera->update();
|
||||||
|
|
||||||
bt->update();
|
bt->update();
|
||||||
|
|
||||||
// roller->update();
|
roller->update();
|
||||||
}
|
}
|
|
@ -110,7 +110,7 @@ void TestMenu::testMenu()
|
||||||
DEBUG.print((char)Serial2.read());
|
DEBUG.print((char)Serial2.read());
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
ballPresence->test();
|
// ballPresence->test();
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
drive->stopAll();
|
drive->stopAll();
|
||||||
|
|
Loading…
Reference in New Issue