Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
cca02549 | 3 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
6f3b6d29 | 4 | import org.usfirst.frc.team3501.robot.subsystems.Intake; |
079a8cb6 | 5 | import org.usfirst.frc.team3501.robot.subsystems.Shooter; |
6acd1f1b | 6 | |
5d967c55 CZ |
7 | import edu.wpi.cscore.UsbCamera; |
8 | import edu.wpi.first.wpilibj.CameraServer; | |
1782cbad | 9 | import edu.wpi.first.wpilibj.DriverStation; |
38a404b3 KZ |
10 | import edu.wpi.first.wpilibj.IterativeRobot; |
11 | import edu.wpi.first.wpilibj.command.Scheduler; | |
1782cbad | 12 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
38a404b3 KZ |
13 | |
14 | public class Robot extends IterativeRobot { | |
6acd1f1b | 15 | private static DriveTrain driveTrain; |
414d5638 | 16 | private static Shooter shooter; |
6acd1f1b | 17 | private static OI oi; |
6f3b6d29 | 18 | private static Intake intake; |
99930d53 | 19 | private static CameraServer server; |
38a404b3 KZ |
20 | |
21 | @Override | |
22 | public void robotInit() { | |
6acd1f1b CZ |
23 | driveTrain = DriveTrain.getDriveTrain(); |
24 | oi = OI.getOI(); | |
079a8cb6 | 25 | shooter = Shooter.getShooter(); |
6f3b6d29 | 26 | intake = Intake.getIntake(); |
99930d53 | 27 | server = CameraServer.getInstance(); |
5d967c55 CZ |
28 | UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0); |
29 | UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1); | |
cca02549 | 30 | } |
6acd1f1b CZ |
31 | |
32 | public static DriveTrain getDriveTrain() { | |
005d6bf0 | 33 | |
6acd1f1b | 34 | return DriveTrain.getDriveTrain(); |
cca02549 | 35 | } |
6acd1f1b | 36 | |
414d5638 | 37 | public static Shooter getShooter() { |
38 | return Shooter.getShooter(); | |
39 | } | |
40 | ||
6acd1f1b CZ |
41 | public static OI getOI() { |
42 | return OI.getOI(); | |
38a404b3 KZ |
43 | } |
44 | ||
6f3b6d29 | 45 | public static Intake getIntake() { |
7992f152 AD |
46 | return Intake.getIntake(); |
47 | } | |
48 | ||
99930d53 RR |
49 | public static void swapCameraFeed() { |
50 | UsbCamera climberCam = server.startAutomaticCapture("climbercam", 1); | |
51 | UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 0); | |
52 | } | |
53 | ||
538715b1 AD |
54 | // If the gear values do not match in the left and right piston, then they are |
55 | // both set to high gear | |
38a404b3 KZ |
56 | @Override |
57 | public void autonomousInit() { | |
e4082bee RR |
58 | driveTrain.setHighGear(driveTrain.getRightPiston()); |
59 | driveTrain.setHighGear(driveTrain.getLeftPiston()); | |
38a404b3 KZ |
60 | } |
61 | ||
62 | @Override | |
63 | public void autonomousPeriodic() { | |
64 | Scheduler.getInstance().run(); | |
38a404b3 KZ |
65 | } |
66 | ||
67 | @Override | |
68 | public void teleopInit() { | |
69 | } | |
70 | ||
71 | @Override | |
72 | public void teleopPeriodic() { | |
88ecb8d3 | 73 | Scheduler.getInstance().run(); |
1782cbad CZ |
74 | updateSmartDashboard(); |
75 | } | |
76 | ||
77 | public void updateSmartDashboard() { | |
78 | SmartDashboard.putNumber("angle", driveTrain.getAngle()); | |
79 | SmartDashboard.putNumber("voltage", | |
80 | DriverStation.getInstance().getBatteryVoltage()); | |
81 | SmartDashboard.putNumber("rpm", shooter.getShooterRPM()); | |
82 | SmartDashboard.putNumber("motor value", shooter.getCurrentShootingSpeed()); | |
38a404b3 KZ |
83 | } |
84 | } |