From 3003eb3a207cdb958fd18817a8825c2348806acd Mon Sep 17 00:00:00 2001 From: Udunen Date: Fri, 12 Apr 2024 10:39:43 -0500 Subject: [PATCH] off and def auton code --- Ri3D 2024.v5code | 1 - Ri3D_2024_off.v5code | 1 + src/main.cpp | 42 +++++++++++++++++++++++++++++++++--------- 3 files changed, 34 insertions(+), 10 deletions(-) delete mode 100644 Ri3D 2024.v5code create mode 100644 Ri3D_2024_off.v5code diff --git a/Ri3D 2024.v5code b/Ri3D 2024.v5code deleted file mode 100644 index 04d4b56..0000000 --- a/Ri3D 2024.v5code +++ /dev/null @@ -1 +0,0 @@ -{"title":"Ri3D 2024","description":"Empty V5 C++ Project","icon":"USER921x.bmp","version":"23.09.1216","sdk":"20220726_10_00_00","language":"cpp","competition":false,"files":[{"name":"include/robot-config.h","type":"File","specialType":"device_config"},{"name":"include/vex.h","type":"File","specialType":""},{"name":"include/joystick.cpp","type":"File","specialType":""},{"name":"makefile","type":"File","specialType":""},{"name":"src/main.cpp","type":"File","specialType":""},{"name":"src/robot-config.cpp","type":"File","specialType":"device_config"},{"name":"vex/mkenv.mk","type":"File","specialType":""},{"name":"vex/mkrules.mk","type":"File","specialType":""},{"name":"include","type":"Directory"},{"name":"src","type":"Directory"},{"name":"vex","type":"Directory"}],"device":{"slot":4,"uid":"276-4810","options":{}},"isExpertMode":false,"isExpertModeRC":false,"isVexFileImport":false,"robotconfig":[],"neverUpdate":null} \ No newline at end of file diff --git a/Ri3D_2024_off.v5code b/Ri3D_2024_off.v5code new file mode 100644 index 0000000..b62848d --- /dev/null +++ b/Ri3D_2024_off.v5code @@ -0,0 +1 @@ +{"title":"Ri3D_2024_off","description":"Empty V5 C++ Project","icon":"USER921x.bmp","version":"23.09.1216","sdk":"20220726_10_00_00","language":"cpp","competition":false,"files":[{"name":"include/robot-config.h","type":"File","specialType":"device_config"},{"name":"include/vex.h","type":"File","specialType":""},{"name":"include/joystick.cpp","type":"File","specialType":""},{"name":"makefile","type":"File","specialType":""},{"name":"src/main.cpp","type":"File","specialType":""},{"name":"src/robot-config.cpp","type":"File","specialType":"device_config"},{"name":"vex/mkenv.mk","type":"File","specialType":""},{"name":"vex/mkrules.mk","type":"File","specialType":""},{"name":"include","type":"Directory"},{"name":"src","type":"Directory"},{"name":"vex","type":"Directory"}],"device":{"slot":3,"uid":"276-4810","options":{}},"isExpertMode":false,"isExpertModeRC":false,"isVexFileImport":false,"robotconfig":[],"neverUpdate":null} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 2a24feb..920b871 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,14 +74,7 @@ class Drives { }; void usercontrol(void) { - inertialSens.setHeading(0.0, degrees); - inertialSens.setRotation(0.0, degrees); - inertialSens.startCalibration(); - while(inertialSens.isCalibrating()) { - task::sleep(10); - } - inertialSens.setHeading(0.0, degrees); - inertialSens.setRotation(0.0, degrees); + while(true) { Drives::fieldOriented(); //zeroes inertial sensor @@ -124,9 +117,30 @@ void usercontrol(void) { void auton(void) { + //Defensive side code below Save to slot 2 + //Drives::robotOriented(0.0,0.0,-25); + //task::sleep(1500); + //Drives::robotOriented(0.0, 50, 0); + // task::sleep(2000); + //Drives::robotOriented(0.0, 0.0, 0); + //Drives::robotOriented(0.0, -50, 0.0); + // task::sleep(1000); + // Drives::robotOriented(0.0, 0.0,-25); + // task::sleep(1200); +// Drives::robotOriented(0.0, 0.0, 0); +//Offensive side code below save to slot 3 + Drives::robotOriented(0.0,0.0,-15); + task::sleep(1200); Drives::robotOriented(0.0, 50, 0); - task::sleep(4000); + task::sleep(2000); Drives::robotOriented(0.0, 0.0, 0); + Drives::robotOriented(0.0, -50, 0.0); + task::sleep(1000); + climb.spin(reverse); + Drives::robotOriented(0.0, 0.0, 0); + task::sleep(1000); + climb.stop(); + } int main() { @@ -140,6 +154,16 @@ int main() { // Initializing Robot Configuration. DO NOT REMOVE! vexcodeInit(); + + inertialSens.setHeading(0.0, degrees); + inertialSens.setRotation(0.0, degrees); + inertialSens.startCalibration(); + while(inertialSens.isCalibrating()) { + task::sleep(10); + } + inertialSens.setHeading(0.0, degrees); + inertialSens.setRotation(0.0, degrees); + Competition.autonomous(auton); Competition.drivercontrol(usercontrol);