From c16be0d88bcc80f03b1377543481c1ad8949413a Mon Sep 17 00:00:00 2001 From: ad101-lab <55064247+ad101-lab@users.noreply.github.com> Date: Tue, 3 May 2022 13:40:39 -0600 Subject: [PATCH] Add option to upload all autons to brain at once --- include/auton.h | 1 + include/defines.h | 8 ++++++++ include/main.h | 3 +++ src/main.cpp | 20 +++++++++++++++++++- uploadAllAutons.py | 13 +++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 include/auton.h create mode 100644 include/defines.h create mode 100644 uploadAllAutons.py diff --git a/include/auton.h b/include/auton.h new file mode 100644 index 00000000..8fb0a53a --- /dev/null +++ b/include/auton.h @@ -0,0 +1 @@ +#define AUTON 8 \ No newline at end of file diff --git a/include/defines.h b/include/defines.h new file mode 100644 index 00000000..bd8befb6 --- /dev/null +++ b/include/defines.h @@ -0,0 +1,8 @@ +#define AUTON_STEAL_LEFT_LEFT_AWP 1 +#define AUTON_STEAL_MID_LEFT_AWP 2 +#define AUTON_STEAL_MID_RIGHT_AWP 3 +#define AUTON_STEAL_RIGHT_RIGHT_AWP 4 +#define AUTON_STEAL_RIGHT_RIGHT_RIGHT_AWP 5 +#define AUTON_RIGHT_DOUBLE_STEAL 6 +#define AUTON_NONE 7 +#define AUTON_SKILLS 8 diff --git a/include/main.h b/include/main.h index b6e470a9..2e0d16e7 100644 --- a/include/main.h +++ b/include/main.h @@ -49,6 +49,9 @@ #include "autoPaths.hpp" +#include "defines.h" +#include "auton.h" + // Auton #include "auton/auton.hpp" #include "auton/autonSelector.hpp" diff --git a/src/main.cpp b/src/main.cpp index 5c0b4eaf..e6cff4ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1705,7 +1705,25 @@ void autonomous() { // autonRoutines.hpp and the implementation is autonRoutines.cpp // autonomousSelector.run(); preAutonRun(); - skills(); + + #if AUTON == AUTON_STEAL_LEFT_LEFT_AWP + leftStealLeftAWP(); + #elif AUTON == AUTON_STEAL_MID_LEFT_AWP + midStealToLeftAWP(); + #elif AUTON == AUTON_STEAL_MID_RIGHT_AWP + midStealToRightAWP(); + #elif AUTON == AUTON_STEAL_RIGHT_RIGHT_AWP + rightStealRightAWP(); + #elif AUTON == AUTON_STEAL_RIGHT_RIGHT_RIGHT_AWP + rightRightStealToRightAWP(); + #elif AUTON == AUTON_RIGHT_DOUBLE_STEAL + rightDoubleSteal(); + #elif AUTON == AUTON_NONE + // Do Nothing + #elif AUTON == AUTON_SKILLS + skills(); + #endif // AUTON + postAuton(); // autonomousSelector.run(); diff --git a/uploadAllAutons.py b/uploadAllAutons.py new file mode 100644 index 00000000..f046915d --- /dev/null +++ b/uploadAllAutons.py @@ -0,0 +1,13 @@ +import os +import time + +autons = ["SLeft LAWP", "SMid LAWP", "SMid RAWP", "SRight RAWP", "SRR RAWP", "Right Double Steal", "None", "Skills"] + +for i in range(len(autons)): + f = open("include/auton.h", "w") + f.write("#define AUTON " + str(i+1)); + f.close() + + print ("pros mu --slot " + str(i+1) + " --name \"" + autons[i] + "\"") + + os.system("pros mu --slot " + str(i+1) + " --name \"" + autons[i] + "\"")