competition fixes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / Robot.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
9ca89e45
CZ
3import org.usfirst.frc.team3501.robot.commandgroups.AutonMiddleGear;
4import org.usfirst.frc.team3501.robot.commandgroups.AutonSideGear;
150f450f 5import org.usfirst.frc.team3501.robot.subsystems.Climber;
cca02549 6import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
6f3b6d29 7import org.usfirst.frc.team3501.robot.subsystems.Intake;
079a8cb6 8import org.usfirst.frc.team3501.robot.subsystems.Shooter;
6acd1f1b 9
5d967c55
CZ
10import edu.wpi.cscore.UsbCamera;
11import edu.wpi.first.wpilibj.CameraServer;
1782cbad 12import edu.wpi.first.wpilibj.DriverStation;
38a404b3 13import edu.wpi.first.wpilibj.IterativeRobot;
9ca89e45 14import edu.wpi.first.wpilibj.command.Command;
38a404b3 15import edu.wpi.first.wpilibj.command.Scheduler;
9ca89e45 16import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
1782cbad 17import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
38a404b3
KZ
18
19public class Robot extends IterativeRobot {
6acd1f1b 20 private static DriveTrain driveTrain;
414d5638 21 private static Shooter shooter;
6acd1f1b 22 private static OI oi;
6f3b6d29 23 private static Intake intake;
150f450f 24 private static Climber climber;
38a404b3 25
9ca89e45
CZ
26 Command autonCommand;
27 SendableChooser autonChooser;
28
38a404b3
KZ
29 @Override
30 public void robotInit() {
6acd1f1b
CZ
31 driveTrain = DriveTrain.getDriveTrain();
32 oi = OI.getOI();
079a8cb6 33 shooter = Shooter.getShooter();
6f3b6d29 34 intake = Intake.getIntake();
150f450f 35 climber = Climber.getClimber();
f56e6ebf 36
9ca89e45
CZ
37 autonChooser = new SendableChooser();
38 autonChooser.addDefault("Middle Gear", new AutonMiddleGear());
39 autonChooser.addObject("Red Boiler Gear",
40 new AutonSideGear("RED", "BOILER"));
41 autonChooser.addObject("Red Retrieval Gear",
42 new AutonSideGear("RED", "RETRIEVAL"));
43 autonChooser.addObject("Blue Boiler Gear",
44 new AutonSideGear("BLUE", "BOILER"));
45 autonChooser.addObject("Blue Retrieval Gear",
46 new AutonSideGear("BLUE", "RETRIEVAL"));
47 SmartDashboard.putData("Autonomous Chooser", autonChooser);
48
5d967c55
CZ
49 CameraServer server = CameraServer.getInstance();
50 UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0);
51 UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1);
cca02549 52 }
6acd1f1b
CZ
53
54 public static DriveTrain getDriveTrain() {
55 return DriveTrain.getDriveTrain();
cca02549 56 }
6acd1f1b 57
414d5638 58 public static Shooter getShooter() {
59 return Shooter.getShooter();
60 }
61
6acd1f1b
CZ
62 public static OI getOI() {
63 return OI.getOI();
38a404b3
KZ
64 }
65
6f3b6d29 66 public static Intake getIntake() {
7992f152
AD
67 return Intake.getIntake();
68 }
69
150f450f
CZ
70 public static Climber getClimber() {
71 return Climber.getClimber();
72 }
73
38a404b3
KZ
74 @Override
75 public void autonomousInit() {
150f450f 76 driveTrain.setLowGear();
9ca89e45
CZ
77
78 // autonCommand = (Command) autonChooser.getSelected();
f74d236d 79 autonCommand = new AutonMiddleGear();
150f450f 80 Scheduler.getInstance().add(autonCommand);
38a404b3
KZ
81 }
82
83 @Override
84 public void autonomousPeriodic() {
85 Scheduler.getInstance().run();
38a404b3
KZ
86 }
87
88 @Override
89 public void teleopInit() {
150f450f 90 driveTrain.setHighGear();
38a404b3
KZ
91 }
92
93 @Override
94 public void teleopPeriodic() {
88ecb8d3 95 Scheduler.getInstance().run();
1782cbad
CZ
96 updateSmartDashboard();
97 }
98
99 public void updateSmartDashboard() {
f56e6ebf
CZ
100 SmartDashboard.putNumber("left encode ",
101 driveTrain.getLeftEncoderDistance());
102 SmartDashboard.putNumber("right encoder",
103 driveTrain.getRightEncoderDistance());
1782cbad
CZ
104 SmartDashboard.putNumber("angle", driveTrain.getAngle());
105 SmartDashboard.putNumber("voltage",
106 DriverStation.getInstance().getBatteryVoltage());
107 SmartDashboard.putNumber("rpm", shooter.getShooterRPM());
f56e6ebf
CZ
108 SmartDashboard.putNumber("target shooting",
109 shooter.getTargetShootingSpeed());
38a404b3
KZ
110 }
111}