add git ignore and empty code base
[3501/autonomous-driving] / src / org / usfirst / frc / team3501 / robot / Robot.java
1
2 package org.usfirst.frc.team3501.robot;
3
4 import edu.wpi.first.wpilibj.IterativeRobot;
5 import edu.wpi.first.wpilibj.command.Command;
6 import edu.wpi.first.wpilibj.command.Scheduler;
7 import edu.wpi.first.wpilibj.livewindow.LiveWindow;
8 import org.usfirst.frc.team3501.robot.commands.ExampleCommand;
9 import org.usfirst.frc.team3501.robot.subsystems.ExampleSubsystem;
10 import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
11 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
12
13 /**
14 * The VM is configured to automatically run this class, and to call the
15 * functions corresponding to each mode, as described in the IterativeRobot
16 * documentation. If you change the name of this class or the package after
17 * creating this project, you must also update the manifest file in the resource
18 * directory.
19 */
20 public class Robot extends IterativeRobot {
21
22 public static final ExampleSubsystem exampleSubsystem = new ExampleSubsystem();
23 public static OI oi;
24
25 Command autonomousCommand;
26 SendableChooser chooser;
27
28 /**
29 * This function is run when the robot is first started up and should be
30 * used for any initialization code.
31 */
32 public void robotInit() {
33 oi = new OI();
34 chooser = new SendableChooser();
35 chooser.addDefault("Default Auto", new ExampleCommand());
36 // chooser.addObject("My Auto", new MyAutoCommand());
37 SmartDashboard.putData("Auto mode", chooser);
38 }
39
40 /**
41 * This function is called once each time the robot enters Disabled mode.
42 * You can use it to reset any subsystem information you want to clear when
43 * the robot is disabled.
44 */
45 public void disabledInit(){
46
47 }
48
49 public void disabledPeriodic() {
50 Scheduler.getInstance().run();
51 }
52
53 /**
54 * This autonomous (along with the chooser code above) shows how to select between different autonomous modes
55 * using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
56 * Dashboard, remove all of the chooser code and uncomment the getString code to get the auto name from the text box
57 * below the Gyro
58 *
59 * You can add additional auto modes by adding additional commands to the chooser code above (like the commented example)
60 * or additional comparisons to the switch structure below with additional strings & commands.
61 */
62 public void autonomousInit() {
63 autonomousCommand = (Command) chooser.getSelected();
64
65 /* String autoSelected = SmartDashboard.getString("Auto Selector", "Default");
66 switch(autoSelected) {
67 case "My Auto":
68 autonomousCommand = new MyAutoCommand();
69 break;
70 case "Default Auto":
71 default:
72 autonomousCommand = new ExampleCommand();
73 break;
74 } */
75
76 // schedule the autonomous command (example)
77 if (autonomousCommand != null) autonomousCommand.start();
78 }
79
80 /**
81 * This function is called periodically during autonomous
82 */
83 public void autonomousPeriodic() {
84 Scheduler.getInstance().run();
85 }
86
87 public void teleopInit() {
88 // This makes sure that the autonomous stops running when
89 // teleop starts running. If you want the autonomous to
90 // continue until interrupted by another command, remove
91 // this line or comment it out.
92 if (autonomousCommand != null) autonomousCommand.cancel();
93 }
94
95 /**
96 * This function is called periodically during operator control
97 */
98 public void teleopPeriodic() {
99 Scheduler.getInstance().run();
100 }
101
102 /**
103 * This function is called periodically during test mode
104 */
105 public void testPeriodic() {
106 LiveWindow.run();
107 }
108 }