Skip to content

Commit

Permalink
off and def auton code
Browse files Browse the repository at this point in the history
  • Loading branch information
Udunen committed Apr 12, 2024
1 parent 6045f06 commit 3003eb3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
1 change: 0 additions & 1 deletion Ri3D 2024.v5code

This file was deleted.

1 change: 1 addition & 0 deletions Ri3D_2024_off.v5code
Original file line number Diff line number Diff line change
@@ -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}
42 changes: 33 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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);

Expand Down

0 comments on commit 3003eb3

Please sign in to comment.