implement singleton pattern for climber and shooter subsystems
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / Robot.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive;
4 import org.usfirst.frc.team3501.robot.subsystems.Climber;
5 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
6 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
7
8 import edu.wpi.first.wpilibj.IterativeRobot;
9 import edu.wpi.first.wpilibj.command.Scheduler;
10
11 public class Robot extends IterativeRobot {
12 private static DriveTrain driveTrain;
13 private static OI oi;
14 private static Climber climber;
15 private static Shooter shooter;
16
17 @Override
18 public void robotInit() {
19 driveTrain = DriveTrain.getDriveTrain();
20 oi = OI.getOI();
21 climber = Climber.getClimber();
22 shooter = Shooter.getShooter();
23
24 }
25
26 public static DriveTrain getDriveTrain() {
27 return DriveTrain.getDriveTrain();
28 }
29
30 public static OI getOI() {
31 return OI.getOI();
32 }
33
34 public static Climber getClimber() {
35 return Climber.getClimber();
36 }
37
38 public static Shooter getShooter() {
39 return Shooter.getShooter();
40 }
41
42 @Override
43 public void autonomousInit() {
44 Scheduler.getInstance().add(new TimeDrive(1.5, 0.4));
45 }
46
47 @Override
48 public void autonomousPeriodic() {
49 Scheduler.getInstance().run();
50
51 }
52
53 @Override
54 public void teleopInit() {
55 }
56
57 @Override
58 public void teleopPeriodic() {
59 Scheduler.getInstance().run();
60
61 }
62 }