continue to flesh out initial codebase
[3501/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / Robot.java
CommitLineData
b449387d
LH
1
2package org.usfirst.frc.team3501.robot;
3
4import edu.wpi.first.wpilibj.IterativeRobot;
5import edu.wpi.first.wpilibj.command.Command;
6import edu.wpi.first.wpilibj.command.Scheduler;
7import edu.wpi.first.wpilibj.livewindow.LiveWindow;
3e4790a8
LH
8import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
9import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
b449387d 10
3e4790a8 11import org.usfirst.frc.team3501.robot.autons.*;
b449387d
LH
12import org.usfirst.frc.team3501.robot.subsystems.*;
13
14public class Robot extends IterativeRobot {
15
16 public static final Drivetrain drivetrain = new Drivetrain();
17 public static final Arm arm = new Arm();
18 public static final Claw claw = new Claw();
19
20 public static OI oi;
21
3e4790a8
LH
22 private SendableChooser autoChooser;
23
24 private Command autonomousCommand;
b449387d
LH
25
26 public void robotInit() {
27 oi = new OI();
28
3e4790a8 29 chooseAuto();
b449387d
LH
30 }
31
32 public void disabledPeriodic() {
33 Scheduler.getInstance().run();
34 }
35
36 public void autonomousInit() {
3e4790a8 37 autonomousCommand = (Command) autoChooser.getSelected();
b449387d
LH
38 autonomousCommand.start();
39 }
40
41 public void autonomousPeriodic() {
42 Scheduler.getInstance().run();
43 }
44
45 public void teleopInit() {
46 autonomousCommand.cancel();
47 }
48
49 public void teleopPeriodic() {
50 Scheduler.getInstance().run();
b449387d
LH
51 }
52
53 public void testPeriodic() {
54 LiveWindow.run();
55 }
3e4790a8
LH
56
57 private void chooseAuto() {
58 autoChooser = new SendableChooser();
59
60 autoChooser.addDefault("Drive over step", new DriveOverStep());
61 autoChooser.addObject("Drive past step", new DrivePastStep());
62
63 SmartDashboard.putData("Auto Mode", autoChooser);
64 }
b449387d 65}