oops tab -> spaces
[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.*;
c0ffc2de 12import org.usfirst.frc.team3501.robot.commands.*;
b449387d 13import org.usfirst.frc.team3501.robot.subsystems.*;
f139e313 14import org.usfirst.frc.team3501.util.AutonData;
b449387d
LH
15
16public class Robot extends IterativeRobot {
17
f3db6e7b
LH
18 public static Drivetrain drivetrain;
19 public static Arm arm;
20 public static Claw claw;
f24c549d 21
f3db6e7b 22 public static Pneumatics pneumatics;
b449387d 23
f3db6e7b 24 public static OI oi;
b449387d 25
f3db6e7b 26 public static AutonData autonData;
3e4790a8 27
f3db6e7b 28 private SendableChooser autonChooser;
3e4790a8 29 private Command autonomousCommand;
b449387d
LH
30
31 public void robotInit() {
f3db6e7b
LH
32 drivetrain = new Drivetrain();
33 arm = new Arm();
34 claw = new Claw();
f24c549d 35
f3db6e7b 36 pneumatics = new Pneumatics();
f24c549d 37
f3db6e7b 38 autonData = new AutonData();
b2640783 39
f3db6e7b 40 oi = new OI();
299be031 41
f3db6e7b 42 chooseAuto();
b449387d
LH
43 }
44
f3db6e7b
LH
45 public void disabledPeriodic() {
46 Scheduler.getInstance().run();
47 }
b449387d
LH
48
49 public void autonomousInit() {
c0ffc2de 50 schedule(new TurnOnCompressor());
f24c549d 51
b2640783
LH
52 autonData.update();
53
54 autonomousCommand = (Command) autonChooser.getSelected();
b449387d
LH
55 autonomousCommand.start();
56 }
57
58 public void autonomousPeriodic() {
59 Scheduler.getInstance().run();
60 }
61
62 public void teleopInit() {
c0ffc2de 63 schedule(new TurnOnCompressor());
f24c549d 64
299be031
LH
65 if (autonomousCommand != null)
66 autonomousCommand.cancel();
b449387d
LH
67 }
68
69 public void teleopPeriodic() {
70 Scheduler.getInstance().run();
b449387d
LH
71 }
72
73 public void testPeriodic() {
74 LiveWindow.run();
75 }
3e4790a8
LH
76
77 private void chooseAuto() {
b2640783 78 autonChooser = new SendableChooser();
3e4790a8 79
b2640783
LH
80 autonChooser.addDefault("Pick up container", new ContainerOverStep());
81 autonChooser.addObject("Drive over step", new DriveOverStep());
82 autonChooser.addObject("Drive past step", new DrivePastStep());
3e4790a8 83
b2640783 84 SmartDashboard.putData("Auto Mode", autonChooser);
3e4790a8 85 }
c0ffc2de
LH
86
87 private void schedule(Command c) {
88 Scheduler.getInstance().add(c);
89 }
b449387d 90}