1278a330a14aa63999100881d93978a7538cd2ff
[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
20 @Override
21 public void robotInit() {
22 driveTrain = DriveTrain.getDriveTrain();
23 oi = OI.getOI();
24 shooter = Shooter.getShooter();
25 intake = Intake.getIntake();
26 CameraServer server = CameraServer.getInstance();
27 UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0);
28 UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1);
29 }
30
31 public static DriveTrain getDriveTrain() {
32
33 return DriveTrain.getDriveTrain();
34 }
35
36 public static Shooter getShooter() {
37 return Shooter.getShooter();
38 }
39
40 public static OI getOI() {
41 return OI.getOI();
42 }
43
44 public static Intake getIntake() {
45 return Intake.getIntake();
46 }
47
48 // If the gear values do not match in the left and right piston, then they are
49 // both set to high gear
50 @Override
51 public void autonomousInit() {
52 driveTrain.setHighGear();
53 }
54
55 @Override
56 public void autonomousPeriodic() {
57 Scheduler.getInstance().run();
58 }
59
60 @Override
61 public void teleopInit() {
62 }
63
64 @Override
65 public void teleopPeriodic() {
66 Scheduler.getInstance().run();
67 updateSmartDashboard();
68 }
69
70 public void updateSmartDashboard() {
71 SmartDashboard.putNumber("angle", driveTrain.getAngle());
72 SmartDashboard.putNumber("voltage",
73 DriverStation.getInstance().getBatteryVoltage());
74 SmartDashboard.putNumber("rpm", shooter.getShooterRPM());
75 SmartDashboard.putNumber("motor value", shooter.getCurrentShootingSpeed());
76 }
77 }