diff --git a/include/complementary_filter.h b/include/behaviour_control/complementary_filter.h similarity index 100% rename from include/complementary_filter.h rename to include/behaviour_control/complementary_filter.h diff --git a/include/data_source.h b/include/behaviour_control/data_source.h old mode 100755 new mode 100644 similarity index 100% rename from include/data_source.h rename to include/behaviour_control/data_source.h diff --git a/include/ds_ctrl.h b/include/behaviour_control/ds_ctrl.h old mode 100755 new mode 100644 similarity index 89% rename from include/ds_ctrl.h rename to include/behaviour_control/ds_ctrl.h index 3871999..ef638e2 --- a/include/ds_ctrl.h +++ b/include/behaviour_control/ds_ctrl.h @@ -1,6 +1,6 @@ #pragma once -#include "data_source.h" +#include "behaviour_control/data_source.h" #include "vars.h" #include #include diff --git a/include/status_vector.h b/include/behaviour_control/status_vector.h similarity index 95% rename from include/status_vector.h rename to include/behaviour_control/status_vector.h index b8553a5..1808892 100644 --- a/include/status_vector.h +++ b/include/behaviour_control/status_vector.h @@ -1,7 +1,7 @@ #pragma once #include -#include "game.h" -#include "systems.h" +#include "strategy_roles/game.h" +#include "position/systems.h" /** * STATUS VECTOR: diff --git a/include/drivecontroller.h b/include/motors_movement/drivecontroller.h old mode 100755 new mode 100644 similarity index 91% rename from include/drivecontroller.h rename to include/motors_movement/drivecontroller.h index ed03785..3ed6332 --- a/include/drivecontroller.h +++ b/include/motors_movement/drivecontroller.h @@ -1,9 +1,12 @@ #pragma once #include -#include "motor.h" + +#include "behaviour_control/complementary_filter.h" +#include "motors_movement/motor.h" + #include "PID_v2.h" -#include "complementary_filter.h" + //PID Constants #define KP 1.5 diff --git a/include/motor.h b/include/motors_movement/motor.h old mode 100755 new mode 100644 similarity index 100% rename from include/motor.h rename to include/motors_movement/motor.h diff --git a/include/linesys_2019.h b/include/position/linesys_2019.h old mode 100755 new mode 100644 similarity index 91% rename from include/linesys_2019.h rename to include/position/linesys_2019.h index 60e2f3d..5f241f1 --- a/include/linesys_2019.h +++ b/include/position/linesys_2019.h @@ -1,10 +1,12 @@ #pragma once -#include "ds_ctrl.h" -#include "systems.h" -#include "vars.h" #include +#include "behaviour_control/ds_ctrl.h" +#include "position/systems.h" + +#include "vars.h" + #define S1I A14 #define S1O A15 #define S2I A16 diff --git a/include/positionsys_camera.h b/include/position/positionsys_camera.h similarity index 95% rename from include/positionsys_camera.h rename to include/position/positionsys_camera.h index 962dfbf..35b68b2 100644 --- a/include/positionsys_camera.h +++ b/include/position/positionsys_camera.h @@ -1,5 +1,6 @@ #include "PID_v2.h" -#include "systems.h" + +#include "position/systems.h" #define CAMERA_CENTER_X 0 #define CAMERA_CENTER_Y -18 diff --git a/include/positionsys_zone.h b/include/position/positionsys_zone.h similarity index 99% rename from include/positionsys_zone.h rename to include/position/positionsys_zone.h index c7d71d6..3600c83 100644 --- a/include/positionsys_zone.h +++ b/include/position/positionsys_zone.h @@ -1,6 +1,6 @@ #pragma once -#include "systems.h" +#include "position/systems.h" //POSITION #define CENTERGOALPOST_VEL1 220 diff --git a/include/systems.h b/include/position/systems.h similarity index 100% rename from include/systems.h rename to include/position/systems.h diff --git a/include/sensors.h b/include/sensors.h deleted file mode 100755 index d71275e..0000000 --- a/include/sensors.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - - -#ifdef SENSORS_CPP -#define s_extr -#else -#define s_extr extern -#endif - -#include -#include "data_source_bno055.h" -#include "data_source_ball.h" -#include "data_source_camera_conicmirror.h" -#include "data_source_camera_vshapedmirror.h" -#include "data_source_us.h" -#include "motor.h" -#include "ds_ctrl.h" -#include "drivecontroller.h" -#include "data_source_bt.h" -#include "systems.h" -#include "linesys_2019.h" -#include "positionsys_zone.h" - -void initSensors(); -void updateSensors(); - -s_extr vector dUs; - -s_extr DataSourceCtrl* usCtrl; -s_extr LineSys2019* linesCtrl; - -s_extr DataSourceBNO055* compass; -s_extr DataSourceBall* ball; -s_extr DataSourceCameraConic* camera; -s_extr DriveController* drive; -s_extr DataSourceBT* bt; - -s_extr int role; \ No newline at end of file diff --git a/include/data_source_us.h b/include/sensors/currently_unused/data_source_us.h old mode 100755 new mode 100644 similarity index 90% rename from include/data_source_us.h rename to include/sensors/currently_unused/data_source_us.h index 5e9e49a..4818495 --- a/include/data_source_us.h +++ b/include/sensors/currently_unused/data_source_us.h @@ -1,5 +1,5 @@ #pragma once -#include "data_source.h" +#include "behaviour_control/data_source.h" #define US_WAIT_TIME 70 diff --git a/include/data_source_ball.h b/include/sensors/data_source_ball.h old mode 100755 new mode 100644 similarity index 84% rename from include/data_source_ball.h rename to include/sensors/data_source_ball.h index 6beb7be..f7eb227 --- a/include/data_source_ball.h +++ b/include/sensors/data_source_ball.h @@ -1,5 +1,5 @@ #pragma once -#include "data_source.h" +#include "behaviour_control/data_source.h" class DataSourceBall : public DataSource{ diff --git a/include/data_source_bno055.h b/include/sensors/data_source_bno055.h old mode 100755 new mode 100644 similarity index 86% rename from include/data_source_bno055.h rename to include/sensors/data_source_bno055.h index d5de4ff..f79de5c --- a/include/data_source_bno055.h +++ b/include/sensors/data_source_bno055.h @@ -1,9 +1,10 @@ #pragma once #include -#include "data_source.h" #include +#include "behaviour_control/data_source.h" + #define DATA_CLOCK 10 class DataSourceBNO055 : public DataSource{ diff --git a/include/data_source_bt.h b/include/sensors/data_source_bt.h similarity index 84% rename from include/data_source_bt.h rename to include/sensors/data_source_bt.h index 35fdf35..880ac86 100644 --- a/include/data_source_bt.h +++ b/include/sensors/data_source_bt.h @@ -1,5 +1,6 @@ #pragma once -#include "data_source.h" + +#include "behaviour_control/data_source.h" #include "vars.h" class DataSourceBT : public DataSource{ diff --git a/include/data_source_camera_conicmirror.h b/include/sensors/data_source_camera_conicmirror.h old mode 100755 new mode 100644 similarity index 94% rename from include/data_source_camera_conicmirror.h rename to include/sensors/data_source_camera_conicmirror.h index 8dc8d23..26040e7 --- a/include/data_source_camera_conicmirror.h +++ b/include/sensors/data_source_camera_conicmirror.h @@ -1,6 +1,6 @@ #pragma once -#include "data_source.h" +#include "behaviour_control/data_source.h" #define startp 105 #define endp 115 diff --git a/include/data_source_camera_vshapedmirror.h b/include/sensors/data_source_camera_vshapedmirror.h similarity index 93% rename from include/data_source_camera_vshapedmirror.h rename to include/sensors/data_source_camera_vshapedmirror.h index 53ee3b2..2a35353 100644 --- a/include/data_source_camera_vshapedmirror.h +++ b/include/sensors/data_source_camera_vshapedmirror.h @@ -1,5 +1,6 @@ #pragma once -#include "data_source.h" + +#include "behaviour_control/data_source.h" class DataSourceCameraVShaped : public DataSource{ diff --git a/include/sensors/sensors.h b/include/sensors/sensors.h new file mode 100644 index 0000000..baff6da --- /dev/null +++ b/include/sensors/sensors.h @@ -0,0 +1,41 @@ +#pragma once + + +#ifdef SENSORS_CPP +#define s_extr +#else +#define s_extr extern +#endif + +#include + +#include "behaviour_control/ds_ctrl.h" +#include "motors_movement/drivecontroller.h" +#include "motors_movement/motor.h" +#include "position/linesys_2019.h" +#include "position/positionsys_zone.h" +#include "position/systems.h" +#include "sensors/data_source_ball.h" +#include "sensors/data_source_bt.h" +#include "sensors/data_source_bno055.h" +#include "sensors/data_source_camera_conicmirror.h" +#include "sensors/data_source_camera_vshapedmirror.h" +#include "sensors/currently_unused/data_source_us.h" + + + +void initSensors(); +void updateSensors(); + +s_extr vector dUs; + +s_extr DataSourceCtrl* usCtrl; +s_extr LineSys2019* linesCtrl; + +s_extr DataSourceBNO055* compass; +s_extr DataSourceBall* ball; +s_extr DataSourceCameraConic* camera; +s_extr DriveController* drive; +s_extr DataSourceBT* bt; + +s_extr int role; \ No newline at end of file diff --git a/include/game.h b/include/strategy_roles/game.h old mode 100755 new mode 100644 similarity index 83% rename from include/game.h rename to include/strategy_roles/game.h index cdbdffc..b2822ce --- a/include/game.h +++ b/include/strategy_roles/game.h @@ -1,8 +1,8 @@ #pragma once #include "vars.h" -#include "sensors.h" -#include "systems.h" +#include "position/systems.h" +#include "sensors/sensors.h" class Game { public: diff --git a/include/games.h b/include/strategy_roles/games.h similarity index 54% rename from include/games.h rename to include/strategy_roles/games.h index df9148f..01c325c 100644 --- a/include/games.h +++ b/include/strategy_roles/games.h @@ -7,9 +7,9 @@ #endif #include -#include "game.h" -#include "goalie.h" -#include "keeper.h" +#include "strategy_roles/game.h" +#include "strategy_roles/goalie.h" +#include "strategy_roles/keeper.h" void initGames(); diff --git a/include/goalie.h b/include/strategy_roles/goalie.h old mode 100755 new mode 100644 similarity index 87% rename from include/goalie.h rename to include/strategy_roles/goalie.h index d92021e..e75f3fd --- a/include/goalie.h +++ b/include/strategy_roles/goalie.h @@ -1,8 +1,8 @@ #pragma once -#include "game.h" -#include "sensors.h" -#include "data_source_camera_vshapedmirror.h" +#include "sensors/data_source_camera_vshapedmirror.h" +#include "sensors/sensors.h" +#include "strategy_roles/game.h" #define TILT_MULT 1.8 #define TILT_DIST 180 diff --git a/include/keeper.h b/include/strategy_roles/keeper.h old mode 100755 new mode 100644 similarity index 96% rename from include/keeper.h rename to include/strategy_roles/keeper.h index ab39d81..c207510 --- a/include/keeper.h +++ b/include/strategy_roles/keeper.h @@ -1,6 +1,6 @@ #pragma once -#include "game.h" +#include "strategy_roles/game.h" #define KEEPER_ATTACK_DISTANCE 190 #define KEEPER_ALONE_ATTACK_TIME 5000 //in millis diff --git a/src/complementary_filter.cpp b/src/behaviour_control/complementary_filter.cpp similarity index 79% rename from src/complementary_filter.cpp rename to src/behaviour_control/complementary_filter.cpp index 164cc48..163572d 100644 --- a/src/complementary_filter.cpp +++ b/src/behaviour_control/complementary_filter.cpp @@ -1,4 +1,4 @@ -#include "complementary_filter.h" +#include "behaviour_control/complementary_filter.h" ComplementaryFilter::ComplementaryFilter(float k){ this->K = k; diff --git a/src/data_source.cpp b/src/behaviour_control/data_source.cpp old mode 100755 new mode 100644 similarity index 96% rename from src/data_source.cpp rename to src/behaviour_control/data_source.cpp index a4d65b3..8df8725 --- a/src/data_source.cpp +++ b/src/behaviour_control/data_source.cpp @@ -1,4 +1,4 @@ -#include "data_source.h" +#include "behaviour_control/data_source.h" DataSource::DataSource(void){ protocol = P_NULL; diff --git a/src/ds_ctrl.cpp b/src/behaviour_control/ds_ctrl.cpp old mode 100755 new mode 100644 similarity index 94% rename from src/ds_ctrl.cpp rename to src/behaviour_control/ds_ctrl.cpp index 07d58e1..f43dd69 --- a/src/ds_ctrl.cpp +++ b/src/behaviour_control/ds_ctrl.cpp @@ -1,4 +1,4 @@ -#include "ds_ctrl.h" +#include "behaviour_control/ds_ctrl.h" using namespace std; diff --git a/src/status_vector.cpp b/src/behaviour_control/status_vector.cpp similarity index 87% rename from src/status_vector.cpp rename to src/behaviour_control/status_vector.cpp index 4475bdf..1fd9ca0 100644 --- a/src/status_vector.cpp +++ b/src/behaviour_control/status_vector.cpp @@ -1,5 +1,5 @@ #define STATUS_VECTOR_CPP -#include "status_vector.h" +#include "behaviour_control/status_vector.h" void initStatusVector(){ currentSVIndex = 0; diff --git a/src/main.cpp b/src/main.cpp index 50ea14e..ae97ede 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,9 +1,9 @@ #include -#include "sensors.h" -#include "games.h" -#include "status_vector.h" -#include "positionsys_zone.h" +#include "behaviour_control/status_vector.h" +#include "position/positionsys_zone.h" +#include "sensors/sensors.h" +#include "strategy_roles/games.h" void setup() { delay(1500); diff --git a/src/drivecontroller.cpp b/src/motors_movement/drivecontroller.cpp old mode 100755 new mode 100644 similarity index 95% rename from src/drivecontroller.cpp rename to src/motors_movement/drivecontroller.cpp index 87c47a5..98773b5 --- a/src/drivecontroller.cpp +++ b/src/motors_movement/drivecontroller.cpp @@ -1,6 +1,6 @@ -#include "drivecontroller.h" -#include "sensors.h" -#include "status_vector.h" +#include "motors_movement/drivecontroller.h" +#include "sensors/sensors.h" +#include "behaviour_control/status_vector.h" DriveController::DriveController(Motor* m1_, Motor* m2_, Motor* m3_, Motor* m4_){ m1 = m1_; diff --git a/src/motor.cpp b/src/motors_movement/motor.cpp old mode 100755 new mode 100644 similarity index 95% rename from src/motor.cpp rename to src/motors_movement/motor.cpp index ccdf0ec..c7a3c21 --- a/src/motor.cpp +++ b/src/motors_movement/motor.cpp @@ -1,4 +1,4 @@ -#include "motor.h" +#include "motors_movement/motor.h" #include "vars.h" #include diff --git a/src/positionsys_camera.cpp b/src/position/positionsys_camera.cpp similarity index 97% rename from src/positionsys_camera.cpp rename to src/position/positionsys_camera.cpp index 2da1996..17c415e 100644 --- a/src/positionsys_camera.cpp +++ b/src/position/positionsys_camera.cpp @@ -1,7 +1,7 @@ -#include "positionsys_camera.h" -#include "status_vector.h" +#include "behaviour_control/status_vector.h" +#include "position/positionsys_camera.h" +#include "sensors/sensors.h" #include "vars.h" -#include "sensors.h" PositionSysCamera::PositionSysCamera() { setCameraPID(); diff --git a/src/positionsys_zone.cpp b/src/position/positionsys_zone.cpp similarity index 99% rename from src/positionsys_zone.cpp rename to src/position/positionsys_zone.cpp index 1ec2ebb..f9836ab 100644 --- a/src/positionsys_zone.cpp +++ b/src/position/positionsys_zone.cpp @@ -1,7 +1,7 @@ -#include "positionsys_zone.h" +#include "behaviour_control/status_vector.h" +#include "position/positionsys_zone.h" +#include "sensors/sensors.h" #include "vars.h" -#include "sensors.h" -#include "status_vector.h" PositionSysZone::PositionSysZone(){ for(int i = 0; i < 3; i++){ diff --git a/src/data_source_us.cpp b/src/sensors/currently_unused/data_source_us.cpp old mode 100755 new mode 100644 similarity index 96% rename from src/data_source_us.cpp rename to src/sensors/currently_unused/data_source_us.cpp index b2431b3..0619dd2 --- a/src/data_source_us.cpp +++ b/src/sensors/currently_unused/data_source_us.cpp @@ -1,6 +1,6 @@ -#include "data_source_us.h" +#include "behaviour_control/status_vector.h" +#include "sensors/currently_unused/data_source_us.h" #include "vars.h" -#include "status_vector.h" DataSourceUS::DataSourceUS(TwoWire* i2c_, int addr) : DataSource(i2c_, addr){ diff --git a/src/data_source_ball.cpp b/src/sensors/data_source_ball.cpp old mode 100755 new mode 100644 similarity index 89% rename from src/data_source_ball.cpp rename to src/sensors/data_source_ball.cpp index fcb5267..8431c8a --- a/src/data_source_ball.cpp +++ b/src/sensors/data_source_ball.cpp @@ -1,6 +1,6 @@ -#include "data_source_ball.h" +#include "behaviour_control/status_vector.h" +#include "sensors/data_source_ball.h" #include "vars.h" -#include "status_vector.h" DataSourceBall :: DataSourceBall(HardwareSerial* ser_, int baud) : DataSource(ser_, baud) { ballSeen = false; diff --git a/src/data_source_bno055.cpp b/src/sensors/data_source_bno055.cpp old mode 100755 new mode 100644 similarity index 87% rename from src/data_source_bno055.cpp rename to src/sensors/data_source_bno055.cpp index 6c6c59e..340dce1 --- a/src/data_source_bno055.cpp +++ b/src/sensors/data_source_bno055.cpp @@ -1,5 +1,5 @@ -#include "data_source_bno055.h" -#include "status_vector.h" +#include "behaviour_control/status_vector.h" +#include "sensors/data_source_bno055.h" //bool loaded = false; diff --git a/src/data_source_bt.cpp b/src/sensors/data_source_bt.cpp similarity index 94% rename from src/data_source_bt.cpp rename to src/sensors/data_source_bt.cpp index ae170aa..4fb2e66 100644 --- a/src/data_source_bt.cpp +++ b/src/sensors/data_source_bt.cpp @@ -1,4 +1,4 @@ -#include "data_source_bt.h" +#include "sensors/data_source_bt.h" DataSourceBT :: DataSourceBT(HardwareSerial* ser_, int baud) : DataSource(ser_, baud){ // connect(); diff --git a/src/data_source_camera_conicmirror.cpp b/src/sensors/data_source_camera_conicmirror.cpp old mode 100755 new mode 100644 similarity index 97% rename from src/data_source_camera_conicmirror.cpp rename to src/sensors/data_source_camera_conicmirror.cpp index a08f874..06919a4 --- a/src/data_source_camera_conicmirror.cpp +++ b/src/sensors/data_source_camera_conicmirror.cpp @@ -1,5 +1,5 @@ -#include "data_source_camera_conicmirror.h" -#include "status_vector.h" +#include "behaviour_control/status_vector.h" +#include "sensors/data_source_camera_conicmirror.h" DataSourceCameraConic::DataSourceCameraConic(HardwareSerial *ser_, int baud) : DataSource(ser_, baud) { @@ -31,7 +31,7 @@ void DataSourceCameraConic ::readSensor() { count = 0; } else if (value == endp) { data_received = false; - if (count = 4 && start == true) { + if ((count = 4) && (start == true)) { data_received = true; true_xb = xb - 50; diff --git a/src/data_source_camera_vshapedmirror.cpp b/src/sensors/data_source_camera_vshapedmirror.cpp similarity index 96% rename from src/data_source_camera_vshapedmirror.cpp rename to src/sensors/data_source_camera_vshapedmirror.cpp index 690e148..c86c88c 100644 --- a/src/data_source_camera_vshapedmirror.cpp +++ b/src/sensors/data_source_camera_vshapedmirror.cpp @@ -1,6 +1,6 @@ -#include "data_source_camera_vshapedmirror.h" -#include "sensors.h" -#include "status_vector.h" +#include "behaviour_control/status_vector.h" +#include "sensors/data_source_camera_vshapedmirror.h" +#include "sensors/sensors.h" DataSourceCameraVShaped::DataSourceCameraVShaped(HardwareSerial* ser_, int baud) : DataSource(ser_, baud){} diff --git a/src/linesys_2019.cpp b/src/sensors/linesys_2019.cpp old mode 100755 new mode 100644 similarity index 98% rename from src/linesys_2019.cpp rename to src/sensors/linesys_2019.cpp index b4497b4..616bef6 --- a/src/linesys_2019.cpp +++ b/src/sensors/linesys_2019.cpp @@ -1,5 +1,5 @@ -#include "linesys_2019.h" -#include "sensors.h" +#include "position/linesys_2019.h" +#include "sensors/sensors.h" using namespace std; LineSys2019::LineSys2019() {} diff --git a/src/sensors.cpp b/src/sensors/sensors.cpp old mode 100755 new mode 100644 similarity index 96% rename from src/sensors.cpp rename to src/sensors/sensors.cpp index 1e72cdb..36ec625 --- a/src/sensors.cpp +++ b/src/sensors/sensors.cpp @@ -1,5 +1,5 @@ #define SENSORS_CPP -#include "sensors.h" +#include "sensors/sensors.h" void initSensors(){ pinMode(SWITCH_DX, INPUT); diff --git a/src/game.cpp b/src/strategy_roles/game.cpp similarity index 82% rename from src/game.cpp rename to src/strategy_roles/game.cpp index 744ae02..397c8b3 100644 --- a/src/game.cpp +++ b/src/strategy_roles/game.cpp @@ -1,5 +1,5 @@ -#include "game.h" -#include "status_vector.h" +#include "behaviour_control/status_vector.h" +#include "strategy_roles/game.h" Game::Game() {} Game::Game(LineSystem* ls_, PositionSystem* ps_) { diff --git a/src/games.cpp b/src/strategy_roles/games.cpp similarity index 76% rename from src/games.cpp rename to src/strategy_roles/games.cpp index 5de6efc..bd499e9 100644 --- a/src/games.cpp +++ b/src/strategy_roles/games.cpp @@ -1,9 +1,9 @@ #define GAMES_CPP -#include "games.h" -#include "linesys_2019.h" -#include "positionsys_zone.h" -#include "positionsys_camera.h" +#include "position/linesys_2019.h" +#include "position/positionsys_zone.h" +#include "position/positionsys_camera.h" +#include "strategy_roles/games.h" void initGames(){ vector lIn = { new DataSource(S1I, true), new DataSource(S2I, true), new DataSource(S3I, true), new DataSource(S4I, true) }; diff --git a/src/goalie.cpp b/src/strategy_roles/goalie.cpp old mode 100755 new mode 100644 similarity index 90% rename from src/goalie.cpp rename to src/strategy_roles/goalie.cpp index 3a74971..86bb68e --- a/src/goalie.cpp +++ b/src/strategy_roles/goalie.cpp @@ -1,9 +1,11 @@ -#include "goalie.h" -#include "sensors.h" +#include "behaviour_control/status_vector.h" +#include "position/positionsys_camera.h" +#include "sensors/sensors.h" +#include "strategy_roles/goalie.h" #include "vars.h" -#include "status_vector.h" + #include "math.h" -#include "positionsys_camera.h" + Goalie::Goalie() : Game() { init(); diff --git a/src/keeper.cpp b/src/strategy_roles/keeper.cpp old mode 100755 new mode 100644 similarity index 93% rename from src/keeper.cpp rename to src/strategy_roles/keeper.cpp index b534fc8..a081a30 --- a/src/keeper.cpp +++ b/src/strategy_roles/keeper.cpp @@ -1,9 +1,11 @@ -#include "keeper.h" -#include "sensors.h" -#include "games.h" -#include "linesys_2019.h" #include -#include "status_vector.h" + +#include "behaviour_control/status_vector.h" +#include "position/linesys_2019.h" +#include "sensors/sensors.h" +#include "strategy_roles/keeper.h" +#include "strategy_roles/games.h" + Keeper::Keeper() : Game() { init();