-
Notifications
You must be signed in to change notification settings - Fork 13
/
Robot.java
81 lines (71 loc) · 2.77 KB
/
Robot.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package org.usfirst.frc.team20.robot;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Robot extends IterativeRobot {
final String defaultAuto = "Default";
final String customAuto = "My Auto";
String autoSelected;
SendableChooser chooser;
int[] CANTalonPorts = new int[4];
DriverStation d = new DriverStation(); //TODO ask Hiren
DriveTrain drive = new DriveTrain(CANTalonPorts, d); // Find 2014 Drive Code for Shifting Gearbox
T20GamePad driverJoy = new T20GamePad(0);
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
chooser = new SendableChooser();
chooser.addDefault("Default Auto", defaultAuto);
chooser.addObject("My Auto", customAuto);
SmartDashboard.putData("Auto choices", chooser);
}
/**
* This autonomous (along with the chooser code above) shows how to select between different autonomous modes
* using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
* Dashboard, remove all of the chooser code and uncomment the getString line to get the auto name from the text box
* below the Gyro
*
* You can add additional auto modes by adding additional comparisons to the switch structure below with additional strings.
* If using the SendableChooser make sure to add them to the chooser code above as well.
*/
public void autonomousInit() {
autoSelected = (String) chooser.getSelected();
// autoSelected = SmartDashboard.getString("Auto Selector", defaultAuto);
System.out.println("Auto selected: " + autoSelected);
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
switch(autoSelected) {
case customAuto:
//Put custom auto code here
break;
case defaultAuto:
default:
//Put default auto code here
break;
}
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
}
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
}
}