| 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 | return DriveTrain.getDriveTrain(); |
| 33 | } |
| 34 | |
| 35 | public static Shooter getShooter() { |
| 36 | return Shooter.getShooter(); |
| 37 | } |
| 38 | |
| 39 | public static OI getOI() { |
| 40 | return OI.getOI(); |
| 41 | } |
| 42 | |
| 43 | public static Intake getIntake() { |
| 44 | return Intake.getIntake(); |
| 45 | } |
| 46 | |
| 47 | // If the gear values do not match in the left and right piston, then they are |
| 48 | // both set to high gear |
| 49 | @Override |
| 50 | public void autonomousInit() { |
| 51 | driveTrain.setHighGear(); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void autonomousPeriodic() { |
| 56 | Scheduler.getInstance().run(); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public void teleopInit() { |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public void teleopPeriodic() { |
| 65 | Scheduler.getInstance().run(); |
| 66 | updateSmartDashboard(); |
| 67 | } |
| 68 | |
| 69 | public void updateSmartDashboard() { |
| 70 | SmartDashboard.putNumber("angle", driveTrain.getAngle()); |
| 71 | SmartDashboard.putNumber("voltage", |
| 72 | DriverStation.getInstance().getBatteryVoltage()); |
| 73 | SmartDashboard.putNumber("rpm", shooter.getShooterRPM()); |
| 74 | SmartDashboard.putNumber("motor value", shooter.getTargetShootingSpeed()); |
| 75 | } |
| 76 | } |