ported goalie and keeper from old code, condtion code working to decide game strategy

pull/1/head
EmaMaker 2019-12-09 19:08:05 +01:00
parent c6856fdbce
commit 20b3aa1b0c
142 changed files with 235 additions and 109 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
.travis.yml Normal file → Executable file
View File

0
.vscode/extensions.json vendored Normal file → Executable file
View File

0
.vscode/settings.json vendored Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
include/data_source.h Normal file → Executable file
View File

0
include/data_source_ball.h Normal file → Executable file
View File

0
include/data_source_bno055.h Normal file → Executable file
View File

0
include/data_source_camera.h Normal file → Executable file
View File

0
include/data_source_controller.h Normal file → Executable file
View File

0
include/data_source_us.h Normal file → Executable file
View File

4
include/drivecontroller.h Normal file → Executable file
View File

@ -15,8 +15,8 @@ class DriveController{
DriveController(Motor* m1_, Motor* m2_, Motor* m3_, Motor* m4_);
void drive(int dir, int speed, int tilt);
void prepareDrive(int dir, int speed, int tilt);
void drive(int dir=0, int speed=0, int tilt=0);
void prepareDrive(int dir=0, int speed=0, int tilt=0);
void drivePrepared();
float updatePid();
float torad(float f);

0
include/ds_ctrl.h Normal file → Executable file
View File

0
include/ds_ctrl_lines.h Normal file → Executable file
View File

19
include/game.h Normal file → Executable file
View File

@ -1,21 +1,12 @@
#pragma once
#include "data_source.h"
#include "data_source_ball.h"
#include "motor.h"
#include "drivecontroller.h"
#include "sensors.h"
#include "vars.h"
#include "data_source_bno055.h"
#include "goalie.h"
#include "keeper.h"
#include "sensors.h"
class Game{
class Game {
public:
Game();
//void keeper();
//void goalie();
//void ballBack();
bool role, attackGoal; //1->goalie 0->keeper, 1->yellow 0->blue
//~Game();
void play(bool condition=true);
private:
virtual void realPlay() = 0;
};

17
include/games.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
#ifdef GAMES_CPP
#define g_extr
#else
#define g_extr extern
#endif
#include <Arduino.h>
#include "game.h"
#include "goalie.h"
#include "keeper.h"
void initGames();
g_extr Game* goalie;
g_extr Game* keeper;

16
include/goalie.h Normal file → Executable file
View File

@ -1,8 +1,10 @@
#pragma once
#include "game.h"
#include "sensors.h"
#include "data_source_camera.h"
/* #define GOALIE_ATKSPD_LAT 255
#define GOALIE_ATKSPD_LAT 255
#define GOALIE_ATKSPD_BAK 350
#define GOALIE_ATKSPD_FRT 345
#define GOALIE_ATKSPD_STRK 355
@ -12,14 +14,18 @@
#define GOALIE_ATKDIR_PLUSANGBAK 40
#define GOALIE_ATKDIR_PLUSANG1_COR 60
#define GOALIE_ATKDIR_PLUSANG2_COR 70
#define GOALIE_ATKDIR_PLUSANG3_COR 70 */
#define GOALIE_ATKDIR_PLUSANG3_COR 70
class Goalie{
class Goalie : public Game{
public:
Goalie();
void realPlay() override;
void goalie();
void ballBack();
//void rigore(); to be implemented
int atk_direction, atk_speed;
void storcimentoPorta();
int atk_speed, atk_direction;
float cstorc;
};

22
include/keeper.h Normal file → Executable file
View File

@ -2,10 +2,26 @@
#include "game.h"
class Keeper{
//KEEPER
#define KEEPER_ATTACK_DISTANCE 200
#define KEEPER_ALONE_ATTACK_TIME 5000 //in millis
#define KEEPER_COMRADE_ATTACK_TIME 3000//in millis
#define KEEPER_BASE_VEL 320
#define KEEPER_VEL_MULT 1.4
#define KEEPER_BALL_BACK_ANGLE 30
class Keeper : public Game{
public:
Keeper();
private:
void realPlay() override;
void keeper();
//void keeperGoalie(); to be implemented
};
int defSpeed, defDir;
float angle, angleX, angleY;
elapsedMillis t, toh, keeperAttackTimer;
bool keeper_tookTimer, keeper_backToGoalPost;
};

0
include/motor.h Normal file → Executable file
View File

41
include/sensors.h Normal file → Executable file
View File

@ -1,5 +1,13 @@
#include <Arduino.h>
#pragma once
#ifdef SENSORS_CPP
#define s_extr
#else
#define s_extr extern
#endif
#include <Arduino.h>
#include "data_source_bno055.h"
#include "data_source_ball.h"
#include "data_source_camera.h"
@ -8,31 +16,20 @@
#include "motor.h"
#include "ds_ctrl.h"
#include "drivecontroller.h"
#include "game.h"
#ifdef SENSORS_CPP
#define extr
#else
#define extr extern
#endif
class Game;
class Goalie;
class Keeper;
void initSensors();
void updateSensors();
extr vector<DataSource*> lIn;
extr vector<DataSource*> lOut;
extr vector<DataSource*> dUs;
s_extr vector<DataSource*> lIn;
s_extr vector<DataSource*> lOut;
s_extr vector<DataSource*> dUs;
extr DataSourceCtrl* usCtrl;
extr DataSourceCtrlLines* linesCtrl;
s_extr DataSourceCtrl* usCtrl;
s_extr DataSourceCtrlLines* linesCtrl;
extr DataSourceBNO055* compass;
extr DataSourceBall* ball;
extr DataSourceCamera* camera;
extr DriveController* drive;
s_extr DataSourceBNO055* compass;
s_extr DataSourceBall* ball;
s_extr DataSourceCamera* camera;
s_extr DriveController* drive;
extr Game* game;
extr Goalie* goalie;
extr Keeper* keeper;
s_extr int role;

0
include/vars.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/.gitignore vendored Normal file → Executable file
View File

0
lib/Adafruit-GFX/.travis.yml Normal file → Executable file
View File

0
lib/Adafruit-GFX/Adafruit_GFX.cpp Normal file → Executable file
View File

0
lib/Adafruit-GFX/Adafruit_GFX.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Adafruit_SPITFT.cpp Normal file → Executable file
View File

0
lib/Adafruit-GFX/Adafruit_SPITFT.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Adafruit_SPITFT_Macros.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMono12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMono18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMono24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMono9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBold12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBold18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBold24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBold9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBoldOblique12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBoldOblique18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBoldOblique24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoBoldOblique9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoOblique12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoOblique18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoOblique24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeMonoOblique9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSans12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSans18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSans24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSans9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBold12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBold18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBold24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBold9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBoldOblique12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBoldOblique18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBoldOblique24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansBoldOblique9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansOblique12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansOblique18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansOblique24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSansOblique9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerif12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerif18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerif24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerif9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBold12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBold18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBold24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBold9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBoldItalic12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBoldItalic18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBoldItalic24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifBoldItalic9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifItalic12pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifItalic18pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifItalic24pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/FreeSerifItalic9pt7b.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/Org_01.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/Picopixel.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/Tiny3x3a2pt7b Normal file → Executable file
View File

0
lib/Adafruit-GFX/Fonts/TomThumb.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/README.md Normal file → Executable file
View File

View File

0
lib/Adafruit-GFX/fontconvert/Makefile Normal file → Executable file
View File

0
lib/Adafruit-GFX/fontconvert/fontconvert.c Normal file → Executable file
View File

0
lib/Adafruit-GFX/fontconvert/fontconvert_win.md Normal file → Executable file
View File

0
lib/Adafruit-GFX/fontconvert/makefonts.sh Normal file → Executable file
View File

0
lib/Adafruit-GFX/gfxfont.h Normal file → Executable file
View File

0
lib/Adafruit-GFX/glcdfont.c Normal file → Executable file
View File

0
lib/Adafruit-GFX/library.properties Normal file → Executable file
View File

0
lib/Adafruit-GFX/license.txt Normal file → Executable file
View File

0
lib/Adafruit_BNO055/Adafruit_BNO055.cpp Normal file → Executable file
View File

0
lib/Adafruit_BNO055/Adafruit_BNO055.h Normal file → Executable file
View File

0
lib/Adafruit_BNO055/OBJLoader/OBJLoader.txt Normal file → Executable file
View File

0
lib/Adafruit_BNO055/OBJLoader/OBJLoader.zip Normal file → Executable file
View File

0
lib/Adafruit_BNO055/README.md Normal file → Executable file
View File

0
lib/Adafruit_BNO055/examples/bunny/bunny.ino Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More