| 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(driveTrain.getRightPiston()); |
| 59 | driveTrain.setHighGear(driveTrain.getLeftPiston()); |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public void autonomousPeriodic() { |
| 64 | Scheduler.getInstance().run(); |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public void teleopInit() { |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public void teleopPeriodic() { |
| 73 | Scheduler.getInstance().run(); |
| 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()); |
| 83 | } |
| 84 | } |