1516b Over Under 2.0
Codebase for 1516b over under season
Loading...
Searching...
No Matches
auton.cpp
Go to the documentation of this file.
1#include "robot/auton.h"
2#include "globals.h"
3#include "pros/apix.h"
4
5using namespace Robot;
6using namespace Robot::Globals;
7
8int Autonomous::auton = 1;
9
10
12if(Autonomous::auton == 1){
13 // Autonomous for Far side defensive zone.
14
15 if (pros::c::registry_get_plugged_type(13) == pros::c::E_DEVICE_IMU) {
16 // 36.994 -58.128 0
17 chassis.setPose(36.994, -58.128, 0);
18 chassis.follow("home_side_auton_path_1.txt", 2000, 15);
19 chassis.follow("home_side_auton_path_2.txt", 2000, 15);
20 chassis.follow("home_side_auton_path_3.txt", 2000, 15);
21 chassis.follow("home_side_auton_path_4.txt", 2000, 15);
22 chassis.follow("home_side_auton_path_5.txt", 2000, 15);
23 }
24 else {
25 ;
26
27 }
28}
29}
30
32 if(Autonomous::auton == 2){
33 // Autonomous for near side offensive zone.
34
35 if (pros::c::registry_get_plugged_type(13) == pros::c::E_DEVICE_IMU) {
36 // -36.851 -58.638 0
37 chassis.setPose(-36.851, -58.638, 0);
38 chassis.follow("far_side_auton_path_1.txt", 2000, 15);
39 chassis.follow("far_side_auton_path_2.txt", 2000, 15);
40 chassis.follow("far_side_auton_path_3.txt", 2000, 15);
41 chassis.follow("far_side_auton_path_4.txt", 2000, 15);
42 }
43 else {
44 ;
45 }
46
47 }
48}
49
50
51void Autonomous::Auton3(Puncher &puncher) {
52 // Autonomous routine for the Skills challenge
53 while (true) {
55 }
56
57}
58
59// Takes in two parameters: The autonomous value as well as the puncher object.
60void Autonomous::AutoDrive(Puncher &puncher, bool autono = false) {
61
62 // Keep the switcher running while the controller down button has not been pressed and the time period is not autonomous
63 if (autono == false) {
65 }
66
67 // Compare the current auton value to run the auton routine
68 if(Autonomous::auton == 1){
70 }
71
72 if(Autonomous::auton == 2){
74 }
75
76 if(Autonomous::auton == 3){
77 Auton3(puncher);
78 }
79
80}
81//
83
84
85 if(controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_RIGHT)) {
86
87
88
90
91 // Checks if the toggler goes out of bounds.
92 if (Autonomous::auton == 4) {
94 }
95
96
97 // Set the controllet text to the current autonomous routine value
98 controller.print(0, 0, "Autonomous prog: %d", Autonomous::auton);
99
100 }
101
102
103
104}
The Autonomous class contains classes and functions related to the robot's autonomous behavior.
Definition auton.h:11
void AutoDrive(Puncher &puncher, bool autono)
Drives the robot autonomously.
Definition auton.cpp:60
void Auton1()
Runs the autonomous path for the far side defensive game strategy.
Definition auton.cpp:11
static int auton
Sets the number of the autonomous program to use.
Definition auton.h:22
void Auton2()
Runs the autonomous path for the near side offensive game strategy.
Definition auton.cpp:31
void AutonSwitcher()
Switches the autonomous program.
Definition auton.cpp:82
void Auton3(Puncher &puncher)
Runs the puncher routine for the Skills Challenge.
Definition auton.cpp:51
Represents a Puncher mechanism for a robot.
Definition puncher.h:12
void run(int autonVal)
Runs the puncher based on the given autonomous value.
Definition puncher.cpp:15
Contains global variables and type definitions for the Robot namespace.
Definition globals.cpp:18
pros::Controller controller
lemlib::Chassis chassis
Contains all objects generated by the 1516B team - Contains all of the subsystems,...
Definition globals.cpp:17