X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FRobot.java;h=8151cde6533837bd15907b3d37a795564a262e6e;hb=150f450f2b4f9e6094d71007507a7b877e05328a;hp=db5e469ff3be6a031e0efbfc571c6a9a13727cfd;hpb=538715b1e58e3217a6411fab2471716700350b51;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index db5e469..8151cde 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -1,18 +1,31 @@ package org.usfirst.frc.team3501.robot; -import org.usfirst.frc.team3501.robot.commands.driving.DriveDistance; +import org.usfirst.frc.team3501.robot.commandgroups.AutonMiddleGear; +import org.usfirst.frc.team3501.robot.commandgroups.AutonSideGear; +import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive; +import org.usfirst.frc.team3501.robot.subsystems.Climber; 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; private static Shooter shooter; private static OI oi; private static Intake intake; + private static Climber climber; + + Command autonCommand; + SendableChooser autonChooser; @Override public void robotInit() { @@ -20,6 +33,23 @@ public class Robot extends IterativeRobot { oi = OI.getOI(); shooter = Shooter.getShooter(); intake = Intake.getIntake(); + climber = Climber.getClimber(); + + 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); } public static DriveTrain getDriveTrain() { @@ -38,31 +68,45 @@ 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 + public static Climber getClimber() { + return Climber.getClimber(); + } + @Override public void autonomousInit() { - Scheduler.getInstance().add(new DriveDistance(25, 10)); - if (driveTrain.getLeftGearPistonValue() != driveTrain - .getRightGearPistonValue()) { - driveTrain.setHighGear(); - } + driveTrain.setLowGear(); + + // autonCommand = (Command) autonChooser.getSelected(); + autonCommand = new TimeDrive(2, 0.6); + Scheduler.getInstance().add(autonCommand); } @Override public void autonomousPeriodic() { Scheduler.getInstance().run(); - } @Override public void teleopInit() { - + driveTrain.setHighGear(); } @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()); } }