X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FRobot.java;h=d551429f97cbf8b261c2b039e023230de5cd1368;hb=9ca89e45fa84b2ec93bc6adf60c7dde1e0a7defb;hp=1cffcb01aeeeae61e0daaae4d795230bda22459f;hpb=8565f6157b0e34288532871e4123f03c15f2179a;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 1cffcb0..d551429 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -1,11 +1,19 @@ package org.usfirst.frc.team3501.robot; +import org.usfirst.frc.team3501.robot.commandgroups.AutonMiddleGear; +import org.usfirst.frc.team3501.robot.commandgroups.AutonSideGear; 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.Command; import edu.wpi.first.wpilibj.command.Scheduler; +import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; public class Robot extends IterativeRobot { private static DriveTrain driveTrain; @@ -13,6 +21,9 @@ public class Robot extends IterativeRobot { private static OI oi; private static Intake intake; + Command autonCommand; + SendableChooser autonChooser; + @Override public void robotInit() { driveTrain = DriveTrain.getDriveTrain(); @@ -20,6 +31,23 @@ public class Robot extends IterativeRobot { shooter = Shooter.getShooter(); intake = Intake.getIntake(); + autonChooser = new SendableChooser(); + autonChooser.addDefault("Middle Gear", new AutonMiddleGear()); + autonChooser.addObject("Red Boiler Gear", + new AutonSideGear("RED", "BOILER")); + autonChooser.addObject("Red Retrieval Gear", + new AutonSideGear("RED", "RETRIEVAL")); + autonChooser.addObject("Blue Boiler Gear", + new AutonSideGear("BLUE", "BOILER")); + autonChooser.addObject("Blue Retrieval Gear", + new AutonSideGear("BLUE", "RETRIEVAL")); + SmartDashboard.putData("Autonomous Chooser", autonChooser); + + 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() { @@ -38,27 +66,43 @@ public class Robot extends IterativeRobot { 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() { - driveTrain.setHighGear(); + // driveTrain.setLowGear(); + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); + + // autonCommand = (Command) autonChooser.getSelected(); + // autonCommand = new TimeDrive(1.5, 0.6); + // Scheduler.getInstance().add(autonCommand); } @Override public void autonomousPeriodic() { Scheduler.getInstance().run(); - } @Override public void teleopInit() { - + // driveTrain.setHighGear(); + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } @Override public void teleopPeriodic() { Scheduler.getInstance().run(); + updateSmartDashboard(); + } + 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()); } }