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