Add code to toggle agitator pistons in RunIndexWheelContinuous
[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.subsystems.DriveTrain;
4 import org.usfirst.frc.team3501.robot.subsystems.Intake;
5 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
6
7 import edu.wpi.cscore.UsbCamera;
8 import edu.wpi.first.wpilibj.CameraServer;
9 import edu.wpi.first.wpilibj.DriverStation;
10 import edu.wpi.first.wpilibj.IterativeRobot;
11 import edu.wpi.first.wpilibj.command.Scheduler;
12 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
13
14 public class Robot extends IterativeRobot {
15 private static DriveTrain driveTrain;
16 private static Shooter shooter;
17 private static OI oi;
18 private static Intake intake;
19 private static CameraServer server;
20
21 @Override
22 public void robotInit() {
23 driveTrain = DriveTrain.getDriveTrain();
24 oi = OI.getOI();
25 shooter = Shooter.getShooter();
26 intake = Intake.getIntake();
27 server = CameraServer.getInstance();
28 UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0);
29 UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1);
30 }
31
32 public static DriveTrain getDriveTrain() {
33
34 return DriveTrain.getDriveTrain();
35 }
36
37 public static Shooter getShooter() {
38 return Shooter.getShooter();
39 }
40
41 public static OI getOI() {
42 return OI.getOI();
43 }
44
45 public static Intake getIntake() {
46 return Intake.getIntake();
47 }
48
49 public static void swapCameraFeed() {
50 UsbCamera climberCam = server.startAutomaticCapture("climbercam", 1);
51 UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 0);
52 }
53
54 // If the gear values do not match in the left and right piston, then they are
55 // both set to high gear
56 @Override
57 public void autonomousInit() {
58 driveTrain.setHighGear();
59 }
60
61 @Override
62 public void autonomousPeriodic() {
63 Scheduler.getInstance().run();
64 }
65
66 @Override
67 public void teleopInit() {
68 }
69
70 @Override
71 public void teleopPeriodic() {
72 Scheduler.getInstance().run();
73 updateSmartDashboard();
74 }
75
76 public void updateSmartDashboard() {
77 SmartDashboard.putNumber("angle", driveTrain.getAngle());
78 SmartDashboard.putNumber("voltage",
79 DriverStation.getInstance().getBatteryVoltage());
80 SmartDashboard.putNumber("rpm", shooter.getShooterRPM());
81 SmartDashboard.putNumber("motor value", shooter.getCurrentShootingSpeed());
82 }
83 }