X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FRobot.java;h=a8c48643019bffbf7786a505e4264316be539b42;hb=f56e6ebf87134eccc3b8bb0e1d2529bd6cb061dd;hp=cc6f1459df0a1d046493936422f2b7d2645094c0;hpb=ac25505b36b679df7b208cfdfc9177a2f27f4c36;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index cc6f145..a8c4864 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -1,19 +1,20 @@ package org.usfirst.frc.team3501.robot; -import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive; import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; import org.usfirst.frc.team3501.robot.subsystems.Intake; import org.usfirst.frc.team3501.robot.subsystems.Shooter; +import edu.wpi.cscore.UsbCamera; +import edu.wpi.first.wpilibj.CameraServer; +import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.IterativeRobot; import edu.wpi.first.wpilibj.command.Scheduler; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; public class Robot extends IterativeRobot { private static DriveTrain driveTrain; private static Shooter shooter; private static OI oi; - private static Shooter shooter; - private static OI oi; private static Intake intake; @Override @@ -22,6 +23,12 @@ public class Robot extends IterativeRobot { oi = OI.getOI(); shooter = Shooter.getShooter(); intake = Intake.getIntake(); + + CameraServer server = CameraServer.getInstance(); + UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0); + UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1); + + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } public static DriveTrain getDriveTrain() { @@ -36,32 +43,55 @@ public class Robot extends IterativeRobot { return OI.getOI(); } - public static OI getOI() { - return OI.getOI(); - } - public static Intake getIntake() { - return Intake.getIntake() + return Intake.getIntake(); } + // If the gear values do not match in the left and right piston, then they are + // both set to high gear @Override public void autonomousInit() { - Scheduler.getInstance().add(new TimeDrive(1.5, 0.4)); + driveTrain.setHighGear(); + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } @Override public void autonomousPeriodic() { Scheduler.getInstance().run(); - } @Override public void teleopInit() { + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } @Override public void teleopPeriodic() { + // driveTrain.printEncoderOutput(); Scheduler.getInstance().run(); + updateSmartDashboard(); + } + + @Override + public void disabledInit() { + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_BRAKE_MODE); + } + // + // @Override + // public void disabledPeriodic() { + // Scheduler.getInstance().add(new RunFlyWheel(2)); + // } + public void updateSmartDashboard() { + SmartDashboard.putNumber("left encode ", + driveTrain.getLeftEncoderDistance()); + SmartDashboard.putNumber("right encoder", + driveTrain.getRightEncoderDistance()); + SmartDashboard.putNumber("angle", driveTrain.getAngle()); + SmartDashboard.putNumber("voltage", + DriverStation.getInstance().getBatteryVoltage()); + SmartDashboard.putNumber("rpm", shooter.getShooterRPM()); + SmartDashboard.putNumber("target shooting", + shooter.getTargetShootingSpeed()); } }