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