diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/AutoGenerator.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/AutoGenerator.java new file mode 100644 index 0000000..f38cf55 --- /dev/null +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/AutoGenerator.java @@ -0,0 +1,46 @@ +package org.usfirst.frc.team3494.robot; + +import java.util.ArrayList; + +import org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive; +import org.usfirst.frc.team3494.robot.commands.auto.XYDrive; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * Class containing methods that return valid lists to pass to + * {@link org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto}. + * + * @since 0.0.3 + * @see org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto + */ +public class AutoGenerator { + /** + * Test method. Drives to XY (36, 36) (inches). + * + * @since 0.0.3 + * @see org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto + * @see org.usfirst.frc.team3494.robot.commands.auto.XYDrive + * @return A list of commands suitable for use with + * {@link org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto}. + */ + public static ArrayList autoOne() { + ArrayList list = new ArrayList(); + list.add(new XYDrive(36, 36)); + return list; + } + + /** + * Drives to the baseline and earns us five points (hopefully.) + * + * @see org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive + * @since 0.0.3 + * @return A list of commands suitable for use with + * {@link org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto}. + */ + public static ArrayList crossBaseLine() { + ArrayList list = new ArrayList(); + list.add(new DistanceDrive(93.25, UnitTypes.INCHES)); + return list; + } +} diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/OI.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/OI.java index 059692b..1eb1091 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/OI.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/OI.java @@ -1,7 +1,7 @@ package org.usfirst.frc.team3494.robot; import org.usfirst.frc.team3494.robot.commands.auto.AngleTurn; -import org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive; +import org.usfirst.frc.team3494.robot.commands.auto.XYDrive; import org.usfirst.frc.team3494.robot.commands.intake.SwitchPosition; import edu.wpi.first.wpilibj.Joystick; @@ -13,9 +13,9 @@ * interface to the commands and command groups that allow control of the robot. */ public class OI { - //// CREATING BUTTONS + // CREATING BUTTONS // One type of button is a joystick button which is any button on a - //// joystick. + // joystick. // You create one by telling it which joystick it's on and which button // number it is. // Joystick stick = new Joystick(port); @@ -52,6 +52,6 @@ public class OI { public OI() { xbox_b.whenPressed(new SwitchPosition()); xbox_y.whenPressed(new AngleTurn(90)); - xbox_x.whenPressed(new DistanceDrive(2, UnitTypes.FEET)); + xbox_x.whenPressed(new XYDrive(24, 24)); } } diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/Robot.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/Robot.java index 5fd6d6e..3100209 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/Robot.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/Robot.java @@ -1,5 +1,7 @@ package org.usfirst.frc.team3494.robot; +import org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto; +import org.usfirst.frc.team3494.robot.commands.auto.XYDrive; import org.usfirst.frc.team3494.robot.subsystems.Climber; import org.usfirst.frc.team3494.robot.subsystems.Drivetrain; import org.usfirst.frc.team3494.robot.subsystems.Intake; @@ -8,6 +10,9 @@ import com.kauailabs.navx.frc.AHRS; +import edu.wpi.cscore.UsbCamera; +import edu.wpi.first.wpilibj.CameraServer; +import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.IterativeRobot; import edu.wpi.first.wpilibj.PowerDistributionPanel; import edu.wpi.first.wpilibj.Preferences; @@ -51,17 +56,21 @@ public class Robot extends IterativeRobot { */ @Override public void robotInit() { - // chooser.addDefault("Default Auto", new ExampleCommand()); - // chooser.addObject("My Auto", new MyAutoCommand()); driveTrain = new Drivetrain(); climber = new Climber(); turret = new Turret(); kompressor = new Kompressor(); intake = new Intake(); + intake.setPiston(Value.kReverse); oi = new OI(); ahrs = new AHRS(SerialPort.Port.kMXP); + // Auto programs come after all subsystems are created + chooser.addDefault("Default Auto", new XYDrive(24, 24)); + chooser.addObject("To the baseline!", new ConstructedAuto(AutoGenerator.crossBaseLine())); + @SuppressWarnings("unused") + UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(); // put chooser on DS - // SmartDashboard.putData("Auto mode", chooser); + SmartDashboard.putData("Auto mode", chooser); // get preferences prefs = Preferences.getInstance(); } @@ -96,16 +105,22 @@ public void disabledPeriodic() { public void autonomousInit() { autonomousCommand = chooser.getSelected(); - /* - * String autoSelected = SmartDashboard.getString("Auto Selector", - * "Default"); switch(autoSelected) { case "My Auto": autonomousCommand - * = new MyAutoCommand(); break; case "Default Auto": default: - * autonomousCommand = new ExampleCommand(); break; } - */ + // String autoSelected = SmartDashboard.getString("Auto Selector", + // "Default"); + // switch (autoSelected) { + // case "My Auto": + // autonomousCommand = new MyAutoCommand(); + // break; + // case "Default Auto": + // default: + // autonomousCommand = new ExampleCommand(); + // break; + // } // schedule the autonomous command (example) - if (autonomousCommand != null) + if (autonomousCommand != null) { autonomousCommand.start(); + } } /** @@ -122,8 +137,9 @@ public void teleopInit() { // teleop starts running. If you want the autonomous to // continue until interrupted by another command, remove // this line or comment it out. - if (autonomousCommand != null) + if (autonomousCommand != null) { autonomousCommand.cancel(); + } } /** @@ -133,6 +149,8 @@ public void teleopInit() { public void teleopPeriodic() { Scheduler.getInstance().run(); SmartDashboard.putNumber("Gyro Z", ahrs.getAngle()); + SmartDashboard.putNumber("distance", Robot.driveTrain.getLeftDistance(UnitTypes.RAWCOUNT)); + SmartDashboard.putNumber("distance inches", Robot.driveTrain.getLeftDistance(UnitTypes.INCHES)); SmartDashboard.putNumber("Motor 0", Robot.pdp.getCurrent(0)); SmartDashboard.putNumber("Motor 1", Robot.pdp.getCurrent(1)); diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/RobotMap.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/RobotMap.java index b2e1d2f..42e1e62 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/RobotMap.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/RobotMap.java @@ -31,6 +31,8 @@ public class RobotMap { // encoders public static final int ENCODER_RIGHT_A = 0; public static final int ENCODER_RIGHT_B = 1; + public static final int ENCODER_LEFT_A = 2; + public static final int ENCODER_LEFT_B = 3; // intake public static final int INTAKE_MOTOR = 0; public static final int UP_MOTOR = 2; diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/UnitTypes.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/UnitTypes.java index a513c70..6d165ae 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/UnitTypes.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/UnitTypes.java @@ -6,5 +6,5 @@ * @since 0.0.0 */ public enum UnitTypes { - INCHES, MILLIMETERS, FEET, RAWCOUNT; + INCHES, FEET, MILLIMETERS, CENTIMETERS, RAWCOUNT, ROTATIONS; } diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/AngleTurn.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/AngleTurn.java index f452f74..4aaa079 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/AngleTurn.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/AngleTurn.java @@ -6,7 +6,8 @@ /** * Turns the robot using the gyro board mounted to the RoboRIO. The angle to - * turn by must be specified in the constructor. + * turn by must be specified in the constructor. Angle tolerance is specified by + * Robot.prefs (key {@code angle tolerance}.) * * @since 0.0.2 * @see org.usfirst.frc.team3494.robot.Robot @@ -15,13 +16,24 @@ public class AngleTurn extends Command { private double angle; - private static double tolerance = Robot.prefs.getDouble("angle tolerance", 2.5); + private static double tolerance; + /** + * Constructor. + * + * @param angle + * The number of degrees to turn. + */ public AngleTurn(double angle) { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); requires(Robot.driveTrain); this.angle = angle; + try { + tolerance = Robot.prefs.getDouble("angle tolerance", 2.5); + } catch (NullPointerException e) { + tolerance = 2.5; + } } // Called just before this Command runs the first time @@ -32,7 +44,6 @@ protected void initialize() { // Called repeatedly when this Command is scheduled to run protected void execute() { if (!((Robot.ahrs.getAngle() > this.angle - tolerance) && (Robot.ahrs.getAngle() < this.angle + tolerance))) { - System.out.println(this.angle); if (this.angle > 0) { Robot.driveTrain.adjustedTankDrive(-0.4, 0.4); Robot.driveTrain.resetRight(); diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/CartesianTurnDrive.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/CartesianTurnDrive.java deleted file mode 100644 index ab9a04a..0000000 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/CartesianTurnDrive.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.usfirst.frc.team3494.robot.commands.auto; - -import org.usfirst.frc.team3494.robot.Robot; -import org.usfirst.frc.team3494.robot.UnitTypes; - -import edu.wpi.first.wpilibj.command.Command; -import edu.wpi.first.wpilibj.command.Scheduler; - -/** - * WIP coordinate drive system. - * - * @see org.usfirst.frc.team3494.robot.commands.auto.AngleTurn - * @see org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive - * @since 0.0.2 - */ -public class CartesianTurnDrive extends Command { - - private double rise; - private double run; - private double hypot; - private double angle; - private boolean isDone = false; - - public CartesianTurnDrive(double rise, double run) { - // Use requires() here to declare subsystem dependencies - // eg. requires(chassis); - requires(Robot.driveTrain); - this.rise = rise; - this.run = run; - // angle = inverse tan(rise/run) - this.angle = Math.toDegrees(Math.atan2(rise, run)); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.ahrs.reset(); - Robot.driveTrain.resetRight(); - double run2 = this.run * this.run; - double rise2 = this.rise * this.rise; - this.hypot = Math.sqrt(run2 + rise2); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - Scheduler.getInstance().add(new AngleTurn(this.angle)); - Robot.driveTrain.resetRight(); - if (Robot.driveTrain.getRightDistance(UnitTypes.INCHES) > this.hypot) { - Robot.driveTrain.adjustedTankDrive(0.3, 0.3); - } else { - this.isDone = true; - } - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return this.isDone; - } - - // Called once after isFinished returns true - protected void end() { - this.isDone = false; - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - } -} diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/ConstructedAuto.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/ConstructedAuto.java new file mode 100644 index 0000000..afbb0f5 --- /dev/null +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/ConstructedAuto.java @@ -0,0 +1,26 @@ +package org.usfirst.frc.team3494.robot.commands.auto; + +import java.util.ArrayList; + +import edu.wpi.first.wpilibj.command.Command; +import edu.wpi.first.wpilibj.command.CommandGroup; + +/** + * Creates an auto program from a passed-in list of commands. + * + * @since 0.0.3 + */ +public class ConstructedAuto extends CommandGroup { + /** + * Constructor. + * + * @param commands + * The list of commands to make an auto sequence from, in + * order. + */ + public ConstructedAuto(ArrayList commands) { + for (Command c : commands) { + this.addSequential(c); + } + } +} diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/DistanceDrive.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/DistanceDrive.java index f862b8e..6992dd4 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/DistanceDrive.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/DistanceDrive.java @@ -16,6 +16,15 @@ public class DistanceDrive extends Command { private double dist; private UnitTypes unit; + /** + * Constructor. + * + * @param distance + * The distance to drive. + * @param unitType + * The unit that the distance is in. + * @see org.usfirst.frc.team3494.robot.UnitTypes + */ public DistanceDrive(double distance, UnitTypes unitType) { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); @@ -34,9 +43,11 @@ protected void initialize() { // Called repeatedly when this Command is scheduled to run @Override protected void execute() { - System.out.println("Driving forward: " + this.dist); - Robot.driveTrain.adjustedTankDrive(0.3, 0.3); - System.out.println("Right distance: " + Robot.driveTrain.getRightDistance(this.unit)); + if (this.dist > Robot.driveTrain.getRightDistance(this.unit)) { + Robot.driveTrain.adjustedTankDrive(0.3, 0.3); + } else { + return; + } } // Make this return true when this Command no longer needs to run execute() diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/XYDrive.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/XYDrive.java new file mode 100644 index 0000000..4c22e5d --- /dev/null +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/auto/XYDrive.java @@ -0,0 +1,35 @@ +package org.usfirst.frc.team3494.robot.commands.auto; + +import org.usfirst.frc.team3494.robot.UnitTypes; + +import edu.wpi.first.wpilibj.command.CommandGroup; + +/** + * Drives to a point relative to the robot. + * + * @since 0.0.3 + */ +public class XYDrive extends CommandGroup { + + private double hypot; + private double angle; + + /** + * Constructor. + * + * @param rise + * The distance along the Y axis that the point is from the + * robot. + * @param run + * The distance along the X axis that the point is from the + * robot. + */ + public XYDrive(double rise, double run) { + double run2 = run * run; + double rise2 = rise * rise; + this.hypot = Math.sqrt(run2 + rise2); + this.angle = Math.toDegrees(Math.atan2(rise, run)); + addSequential(new AngleTurn(angle)); + addSequential(new DistanceDrive(hypot, UnitTypes.INCHES)); + } +} diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/Drive.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/Drive.java index 8d5d81e..3a0cd24 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/Drive.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/Drive.java @@ -6,10 +6,13 @@ import edu.wpi.first.wpilibj.command.Command; /** - * Command to run drivetrain. Only takes input in the form of joysticks - * (commands for auto moving coming soontm) + * Command to run drivetrain. Only takes input in the form of joysticks. * - * @see org.usfirst.frc.team3494.robot.subsystems.Drivetrain + * @see org.usfirst.frc.team3494.robot.subsystems.Drivetrain Drivetrain + * @see org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive Distance + * Driving (auto) + * @see org.usfirst.frc.team3494.robot.commands.auto.AngleTurn Angle Driving + * (auto) */ public class Drive extends Command { diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/package-info.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/package-info.java index 44ef01f..ee697cc 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/package-info.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/drive/package-info.java @@ -1,6 +1,5 @@ /** - * Package for storing all drive-related commands (aside from autonomous. - * There's a separate package for those coming.) + * Package for storing all drive-related commands (aside from autonomous.) */ package org.usfirst.frc.team3494.robot.commands.drive; diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.java index 7946224..78ebc8e 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.java @@ -25,14 +25,9 @@ protected void initialize() { // Called repeatedly when this Command is scheduled to run protected void execute() { if (Robot.oi.xbox_lt.get()) { - this.speed = 1; - this.running = !this.running; + Robot.intake.runIntake(0.75); } else if (Robot.oi.xbox_rt.get()) { - this.speed = -1; - this.running = !this.running; - } - if (running) { - Robot.intake.runIntake(this.speed); + Robot.intake.runIntake(-0.75); } else { Robot.intake.stopAll(); } diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Climber.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Climber.java index df0a893..f64db20 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Climber.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Climber.java @@ -3,7 +3,7 @@ import org.usfirst.frc.team3494.robot.DriveDirections; import org.usfirst.frc.team3494.robot.RobotMap; -import edu.wpi.first.wpilibj.TalonSRX; +import edu.wpi.first.wpilibj.Talon; import edu.wpi.first.wpilibj.command.Subsystem; /** @@ -12,13 +12,16 @@ * @since 0.0.0 */ public class Climber extends Subsystem implements IMotorizedSubsystem { - private TalonSRX motor; + + private Talon motor; + private boolean driveTrainMode; // Put methods for controlling this subsystem // here. Call these from Commands. public Climber() { super("Climber"); - motor = new TalonSRX(RobotMap.CLIMBER_MOTOR); + this.motor = new Talon(RobotMap.CLIMBER_MOTOR); + this.driveTrainMode = false; } @Override @@ -36,9 +39,9 @@ public void initDefaultCommand() { * will stop the climber. */ public void climb(DriveDirections dir) { - if (dir.equals(DriveDirections.UP)) { + if (dir.equals(DriveDirections.UP) && !this.driveTrainMode) { motor.set(0.4); - } else if (dir.equals(DriveDirections.DOWN)) { + } else if (dir.equals(DriveDirections.DOWN) && !this.driveTrainMode) { motor.set(-0.4); } else { // stop the climber diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.java index 6b6538b..05e1081 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.java @@ -64,16 +64,22 @@ public class Drivetrain extends Subsystem implements IMotorizedSubsystem { */ public RobotDrive wpiDrive; private Encoder encRight; + private Encoder encLeft; + + private static double RAMP = 0.6; public Drivetrain() { super("Drivetrain"); this.driveLeftMaster = new CANTalon(RobotMap.leftTalonOne); this.driveLeftMaster.enableBrakeMode(true); + this.driveLeftMaster.setVoltageRampRate(RAMP); this.driveLeftFollower_One = new CANTalon(RobotMap.leftTalonTwo); this.driveLeftFollower_One.enableBrakeMode(true); + this.driveLeftFollower_One.setVoltageRampRate(RAMP); this.driveLeftFollower_Two = new CANTalon(RobotMap.leftTalonThree); this.driveLeftFollower_Two.enableBrakeMode(true); + this.driveLeftFollower_Two.setVoltageRampRate(RAMP); // master follower this.driveLeftFollower_One.changeControlMode(CANTalon.TalonControlMode.Follower); this.driveLeftFollower_One.set(driveLeftMaster.getDeviceID()); @@ -82,10 +88,13 @@ public Drivetrain() { this.driveRightMaster = new CANTalon(RobotMap.rightTalonOne); this.driveRightMaster.enableBrakeMode(true); + this.driveRightMaster.setVoltageRampRate(RAMP); this.driveRightFollower_One = new CANTalon(RobotMap.rightTalonTwo); this.driveRightFollower_One.enableBrakeMode(true); + this.driveRightFollower_One.setVoltageRampRate(RAMP); this.driveRightFollower_Two = new CANTalon(RobotMap.rightTalonThree); - this.driveLeftFollower_Two.enableBrakeMode(true); + this.driveRightFollower_Two.enableBrakeMode(true); + this.driveRightFollower_Two.setVoltageRampRate(RAMP); // master follower this.driveRightFollower_One.changeControlMode(CANTalon.TalonControlMode.Follower); this.driveRightFollower_One.set(driveRightMaster.getDeviceID()); @@ -94,10 +103,13 @@ public Drivetrain() { this.wpiDrive = new RobotDrive(driveLeftMaster, driveRightMaster); - this.encRight = new Encoder(RobotMap.ENCODER_RIGHT_A, RobotMap.ENCODER_RIGHT_B, false, - Encoder.EncodingType.k4X); - this.encRight.setDistancePerPulse(1 / 1440); + this.encRight = new Encoder(RobotMap.ENCODER_RIGHT_A, RobotMap.ENCODER_RIGHT_B); + this.encRight.setDistancePerPulse(1 / 360); this.encRight.reset(); + + this.encLeft = new Encoder(RobotMap.ENCODER_LEFT_A, RobotMap.ENCODER_LEFT_B, true); + this.encLeft.setDistancePerPulse(1 / 360); + this.encLeft.reset(); } // Put methods for controlling this subsystem // here. Call these from Commands. @@ -150,21 +162,31 @@ public void adjustedTankDrive(double left, double right) { * unit. */ public double getRightDistance(UnitTypes unit) { - double inches; - try { - inches = ((Math.PI * 4) * (this.encRight.get() / 1440) * 360); - } catch (ArithmeticException e) { - inches = 0; - } + double inches = (Math.PI * 4) * (this.encRight.get() / 360); if (unit.equals(UnitTypes.INCHES)) { return inches; } else if (unit.equals(UnitTypes.FEET)) { - return inches / 12; + return inches / 12.0D; + } else if (unit.equals(UnitTypes.MILLIMETERS)) { + return inches * 25.400; + } else if (unit.equals(UnitTypes.CENTIMETERS)) { + return inches * 2.540; } else { return this.encRight.get(); } } + public double getLeftDistance(UnitTypes unit) { + double inches = (Math.PI * 4) * (this.encLeft.get() / 360.0D); + if (unit.equals(UnitTypes.INCHES)) { + return inches; + } else if (unit.equals(UnitTypes.FEET)) { + return inches / 12.0D; + } else { + return this.encLeft.get(); + } + } + /** * Resets the encoder on the right side of the drivetrain. */ diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Intake.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Intake.java index 4c6060e..2c2ed95 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Intake.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Intake.java @@ -4,7 +4,7 @@ import org.usfirst.frc.team3494.robot.commands.intake.RunIntake; import edu.wpi.first.wpilibj.DoubleSolenoid; -import edu.wpi.first.wpilibj.TalonSRX; +import edu.wpi.first.wpilibj.Talon; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; @@ -19,16 +19,16 @@ public class Intake extends Subsystem implements IMotorizedSubsystem { * * @see RobotMap */ - private TalonSRX inMotor; - private TalonSRX upMotor; + private Talon inMotor; + private Talon upMotor; // pistons push private DoubleSolenoid piston; public boolean isDeployed; public Intake() { super("Intake"); - this.inMotor = new TalonSRX(RobotMap.INTAKE_MOTOR); - this.upMotor = new TalonSRX(RobotMap.UP_MOTOR); + this.inMotor = new Talon(RobotMap.INTAKE_MOTOR); + this.upMotor = new Talon(RobotMap.UP_MOTOR); this.piston = new DoubleSolenoid(RobotMap.INTAKE_PISTON_CHONE, RobotMap.INTAKE_PISTON_CHTWO); this.isDeployed = false; } diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Turret.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Turret.java index 64b87dc..8009960 100644 --- a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Turret.java +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/subsystems/Turret.java @@ -66,7 +66,7 @@ public double getDistance(TurretEncoders enc) { } /** - * Turns the turret at a hardcoded speed in the specified direction. + * Turns the turret at a hard-coded speed in the specified direction. * * @param dir * The direction to turn in. Defaults to right if you put in @@ -79,4 +79,9 @@ public void turnTurret(DriveDirections dir) { this.turretRing.set(-turretTurnPower); } } + + public void shoot(double power) { + this.shooterUpper.set(power); + this.shooterLower.set(power); + } } diff --git a/3494_2017_repo/src/org/usfirst/frc/team3494/robot/vision/GripPipeline.java b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/vision/GripPipeline.java new file mode 100644 index 0000000..9c23c2f --- /dev/null +++ b/3494_2017_repo/src/org/usfirst/frc/team3494/robot/vision/GripPipeline.java @@ -0,0 +1,217 @@ +package org.usfirst.frc.team3494.robot.vision; + +import java.util.ArrayList; +import java.util.List; + +import org.opencv.core.Core; +import org.opencv.core.CvType; +import org.opencv.core.Mat; +import org.opencv.core.MatOfInt; +import org.opencv.core.MatOfPoint; +import org.opencv.core.MatOfPoint2f; +import org.opencv.core.Rect; +import org.opencv.core.Scalar; +import org.opencv.imgproc.Imgproc; + +import edu.wpi.first.wpilibj.vision.VisionPipeline; + +/** + * GripPipeline class. + * + *

+ * An OpenCV pipeline generated by GRIP. Docs are poor at best. + *

+ * + * @author GRIP + */ +public class GripPipeline implements VisionPipeline { + + // Outputs + private Mat hslThresholdOutput = new Mat(); + private ArrayList findContoursOutput = new ArrayList(); + private ArrayList filterContoursOutput = new ArrayList(); + + static { + System.loadLibrary(Core.NATIVE_LIBRARY_NAME); + } + + /** + * This is the primary method that runs the entire pipeline and updates the + * outputs. + */ + @Override + public void process(Mat source0) { + // Step HSL_Threshold0: + Mat hslThresholdInput = source0; + double[] hslThresholdHue = { 77.6978417266187, 92.45733788395904 }; + double[] hslThresholdSaturation = { 171.98741007194243, 255.0 }; + double[] hslThresholdLuminance = { 43.57014388489208, 255.0 }; + hslThreshold(hslThresholdInput, hslThresholdHue, hslThresholdSaturation, hslThresholdLuminance, + hslThresholdOutput); + + // Step Find_Contours0: + Mat findContoursInput = hslThresholdOutput; + boolean findContoursExternalOnly = false; + findContours(findContoursInput, findContoursExternalOnly, findContoursOutput); + + // Step Filter_Contours0: + ArrayList filterContoursContours = findContoursOutput; + double filterContoursMinArea = 125.0; + double filterContoursMinPerimeter = 0.0; + double filterContoursMinWidth = 0.0; + double filterContoursMaxWidth = 1000.0; + double filterContoursMinHeight = 0.0; + double filterContoursMaxHeight = 1000.0; + double[] filterContoursSolidity = { 0, 100 }; + double filterContoursMaxVertices = 1000000.0; + double filterContoursMinVertices = 0.0; + double filterContoursMinRatio = 0.0; + double filterContoursMaxRatio = 1000.0; + filterContours(filterContoursContours, filterContoursMinArea, filterContoursMinPerimeter, + filterContoursMinWidth, filterContoursMaxWidth, filterContoursMinHeight, filterContoursMaxHeight, + filterContoursSolidity, filterContoursMaxVertices, filterContoursMinVertices, filterContoursMinRatio, + filterContoursMaxRatio, filterContoursOutput); + + } + + /** + * This method is a generated getter for the output of a HSL_Threshold. + * + * @return Mat output from HSL_Threshold. + */ + public Mat hslThresholdOutput() { + return hslThresholdOutput; + } + + /** + * This method is a generated getter for the output of a Find_Contours. + * + * @return ArrayList<MatOfPoint> output from Find_Contours. + */ + public ArrayList findContoursOutput() { + return findContoursOutput; + } + + /** + * This method is a generated getter for the output of a Filter_Contours. + * + * @return ArrayList<MatOfPoint> output from Filter_Contours. + */ + public ArrayList filterContoursOutput() { + return filterContoursOutput; + } + + /** + * Segment an image based on hue, saturation, and luminance ranges. + * + * @param input + * The image on which to perform the HSL threshold. + * @param hue + * The min and max hue + * @param sat + * The min and max saturation + * @param lum + * The min and max luminance + * @param out + * The image in which to store the output. + */ + private void hslThreshold(Mat input, double[] hue, double[] sat, double[] lum, Mat out) { + Imgproc.cvtColor(input, out, Imgproc.COLOR_BGR2HLS); + Core.inRange(out, new Scalar(hue[0], lum[0], sat[0]), new Scalar(hue[1], lum[1], sat[1]), out); + } + + /** + * Sets the values of pixels in a binary image to their distance to the + * nearest black pixel. + * + * @param input + * The image on which to perform the Distance Transform. + * @param type + * The Transform. + * @param maskSize + * the size of the mask. + * @param output + * The image in which to store the output. + */ + private void findContours(Mat input, boolean externalOnly, List contours) { + Mat hierarchy = new Mat(); + contours.clear(); + int mode; + if (externalOnly) { + mode = Imgproc.RETR_EXTERNAL; + } else { + mode = Imgproc.RETR_LIST; + } + int method = Imgproc.CHAIN_APPROX_SIMPLE; + Imgproc.findContours(input, contours, hierarchy, mode, method); + } + + /** + * Filters out contours that do not meet certain criteria. + * + * @param inputContours + * is the input list of contours + * @param output + * is the the output list of contours + * @param minArea + * is the minimum area of a contour that will be kept + * @param minPerimeter + * is the minimum perimeter of a contour that will be kept + * @param minWidth + * minimum width of a contour + * @param maxWidth + * maximum width + * @param minHeight + * minimum height + * @param maxHeight + * maximimum height + * @param solidity + * the minimum and maximum solidity of a contour + * @param minVertexCount + * minimum vertex Count of the contours + * @param maxVertexCount + * maximum vertex Count + * @param minRatio + * minimum ratio of width to height + * @param maxRatio + * maximum ratio of width to height + */ + private void filterContours(List inputContours, double minArea, double minPerimeter, double minWidth, + double maxWidth, double minHeight, double maxHeight, double[] solidity, double maxVertexCount, + double minVertexCount, double minRatio, double maxRatio, List output) { + final MatOfInt hull = new MatOfInt(); + output.clear(); + // operation + for (int i = 0; i < inputContours.size(); i++) { + final MatOfPoint contour = inputContours.get(i); + final Rect bb = Imgproc.boundingRect(contour); + if (bb.width < minWidth || bb.width > maxWidth) + continue; + if (bb.height < minHeight || bb.height > maxHeight) + continue; + final double area = Imgproc.contourArea(contour); + if (area < minArea) + continue; + if (Imgproc.arcLength(new MatOfPoint2f(contour.toArray()), true) < minPerimeter) + continue; + Imgproc.convexHull(contour, hull); + MatOfPoint mopHull = new MatOfPoint(); + mopHull.create((int) hull.size().height, 1, CvType.CV_32SC2); + for (int j = 0; j < hull.size().height; j++) { + int index = (int) hull.get(j, 0)[0]; + double[] point = new double[] { contour.get(index, 0)[0], contour.get(index, 0)[1] }; + mopHull.put(j, 0, point); + } + final double solid = 100 * area / Imgproc.contourArea(mopHull); + if (solid < solidity[0] || solid > solidity[1]) + continue; + if (contour.rows() < minVertexCount || contour.rows() > maxVertexCount) + continue; + final double ratio = bb.width / (double) bb.height; + if (ratio < minRatio || ratio > maxRatio) + continue; + output.add(contour); + } + } + +} diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index f756ed0..7efe716 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -2,9 +2,9 @@ - + All Classes - + @@ -13,13 +13,15 @@

All Classes

diff --git a/docs/allclasses-noframe.html b/docs/allclasses-noframe.html index b5d3905..6b92905 100644 --- a/docs/allclasses-noframe.html +++ b/docs/allclasses-noframe.html @@ -2,9 +2,9 @@ - + All Classes - + @@ -13,13 +13,15 @@

All Classes

diff --git a/docs/constant-values.html b/docs/constant-values.html index 1d2040c..f6bd2f0 100644 --- a/docs/constant-values.html +++ b/docs/constant-values.html @@ -2,9 +2,9 @@ - + Constant Field Values - + @@ -112,6 +112,20 @@

org.usfirst.*

0.1 + + +public static final int +ENCODER_LEFT_A +2 + + + + +public static final int +ENCODER_LEFT_B +3 + + public static final int diff --git a/docs/deprecated-list.html b/docs/deprecated-list.html index 88ef363..eb92f6e 100644 --- a/docs/deprecated-list.html +++ b/docs/deprecated-list.html @@ -2,9 +2,9 @@ - + Deprecated List - + diff --git a/docs/help-doc.html b/docs/help-doc.html index 9715263..c36b386 100644 --- a/docs/help-doc.html +++ b/docs/help-doc.html @@ -2,9 +2,9 @@ - + API Help - + diff --git a/docs/index-files/index-1.html b/docs/index-files/index-1.html index 74784b5..2fab93b 100644 --- a/docs/index-files/index-1.html +++ b/docs/index-files/index-1.html @@ -2,9 +2,9 @@ - + A-Index - + @@ -69,7 +69,7 @@ -
A C D E G H I K L M O P R S T U V W X  +
A C D E F G H I K L M O P R S T U V W X 

A

@@ -84,13 +84,22 @@

A

angle - Variable in class org.usfirst.frc.team3494.robot.commands.auto.AngleTurn
 
-
angle - Variable in class org.usfirst.frc.team3494.robot.commands.auto.CartesianTurnDrive
+
angle - Variable in class org.usfirst.frc.team3494.robot.commands.auto.XYDrive
 
AngleTurn - Class in org.usfirst.frc.team3494.robot.commands.auto
Turns the robot using the gyro board mounted to the RoboRIO.
AngleTurn(double) - Constructor for class org.usfirst.frc.team3494.robot.commands.auto.AngleTurn
+
+
Constructor.
+
+
AutoGenerator - Class in org.usfirst.frc.team3494.robot
+
+
Class containing methods that return valid lists to pass to + ConstructedAuto.
+
+
AutoGenerator() - Constructor for class org.usfirst.frc.team3494.robot.AutoGenerator
 
autonomousCommand - Variable in class org.usfirst.frc.team3494.robot.Robot
 
@@ -103,8 +112,12 @@

A

This function is called periodically during autonomous.
+
autoOne() - Static method in class org.usfirst.frc.team3494.robot.AutoGenerator
+
+
Test method.
+
-A C D E G H I K L M O P R S T U V W X 
+A C D E F G H I K L M O P R S T U V W X 
diff --git a/docs/index-files/index-10.html b/docs/index-files/index-10.html index 98017e7..235964f 100644 --- a/docs/index-files/index-10.html +++ b/docs/index-files/index-10.html @@ -2,9 +2,9 @@ - -M-Index - + +L-Index + @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -69,17 +69,11 @@
-
A C D E G H I K L M O P R S T U V W X  +
A C D E F G H I K L M O P R S T U V W X 

C

-
CartesianTurnDrive - Class in org.usfirst.frc.team3494.robot.commands.auto
-
-
WIP coordinate drive system.
-
-
CartesianTurnDrive(double, double) - Constructor for class org.usfirst.frc.team3494.robot.commands.auto.CartesianTurnDrive
-
 
chooser - Variable in class org.usfirst.frc.team3494.robot.Robot
 
Climb - Class in org.usfirst.frc.team3494.robot.commands.climb
@@ -108,8 +102,20 @@

C

 
COMPRESSOR - Static variable in class org.usfirst.frc.team3494.robot.RobotMap
 
+
ConstructedAuto - Class in org.usfirst.frc.team3494.robot.commands.auto
+
+
Creates an auto program from a passed-in list of commands.
+
+
ConstructedAuto(ArrayList<Command>) - Constructor for class org.usfirst.frc.team3494.robot.commands.auto.ConstructedAuto
+
+
Constructor.
+
+
crossBaseLine() - Static method in class org.usfirst.frc.team3494.robot.AutoGenerator
+
+
Drives to the baseline and earns us five points (hopefully.)
+
-A C D E G H I K L M O P R S T U V W X 
+A C D E F G H I K L M O P R S T U V W X 
diff --git a/docs/index-files/index-20.html b/docs/index-files/index-20.html new file mode 100644 index 0000000..8b36ccf --- /dev/null +++ b/docs/index-files/index-20.html @@ -0,0 +1,149 @@ + + + + + +X-Index + + + + + + + + +
+ + + + + + + +
+ + +
A C D E F G H I K L M O P R S T U V W X  + + +

X

+
+
xbox - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
xbox_a - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
xbox_b - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
xbox_lt - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
xbox_rt - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
xbox_x - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
xbox_y - Variable in class org.usfirst.frc.team3494.robot.OI
+
 
+
XYDrive - Class in org.usfirst.frc.team3494.robot.commands.auto
+
+
Drives to a point relative to the robot.
+
+
XYDrive(double, double) - Constructor for class org.usfirst.frc.team3494.robot.commands.auto.XYDrive
+
+
Constructor.
+
+
+A C D E F G H I K L M O P R S T U V W X 
+ +
+ + + + + + + +
+ + + + diff --git a/docs/index-files/index-3.html b/docs/index-files/index-3.html index 1bc0b04..cfb3e4d 100644 --- a/docs/index-files/index-3.html +++ b/docs/index-files/index-3.html @@ -2,9 +2,9 @@ - + D-Index - + @@ -69,7 +69,7 @@
-
A C D E G H I K L M O P R S T U V W X  +
A C D E F G H I K L M O P R S T U V W X 

D

@@ -91,7 +91,9 @@

D

Drives a given distance.
DistanceDrive(double, UnitTypes) - Constructor for class org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive
-
 
+
+
Constructor.
+
Drive - Class in org.usfirst.frc.team3494.robot.commands.drive
Command to run drivetrain.
@@ -140,8 +142,10 @@

D

Drivetrain() - Constructor for class org.usfirst.frc.team3494.robot.subsystems.Drivetrain
 
+
driveTrainMode - Variable in class org.usfirst.frc.team3494.robot.subsystems.Climber
+
 
-A C D E G H I K L M O P R S T U V W X 
+A C D E F G H I K L M O P R S T U V W X 
-
A C D E G H I K L M O P R S T U V W X  +
A C D E F G H I K L M O P R S T U V W X 

E

+
encLeft - Variable in class org.usfirst.frc.team3494.robot.subsystems.Drivetrain
+
 
+
ENCODER_LEFT_A - Static variable in class org.usfirst.frc.team3494.robot.RobotMap
+
 
+
ENCODER_LEFT_B - Static variable in class org.usfirst.frc.team3494.robot.RobotMap
+
 
ENCODER_RIGHT_A - Static variable in class org.usfirst.frc.team3494.robot.RobotMap
 
ENCODER_RIGHT_B - Static variable in class org.usfirst.frc.team3494.robot.RobotMap
@@ -82,8 +88,6 @@

E

 
end() - Method in class org.usfirst.frc.team3494.robot.commands.auto.AngleTurn
 
-
end() - Method in class org.usfirst.frc.team3494.robot.commands.auto.CartesianTurnDrive
-
 
end() - Method in class org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive
 
end() - Method in class org.usfirst.frc.team3494.robot.commands.climb.Climb
@@ -98,8 +102,6 @@

E

 
execute() - Method in class org.usfirst.frc.team3494.robot.commands.auto.AngleTurn
 
-
execute() - Method in class org.usfirst.frc.team3494.robot.commands.auto.CartesianTurnDrive
-
 
execute() - Method in class org.usfirst.frc.team3494.robot.commands.auto.DistanceDrive
 
execute() - Method in class org.usfirst.frc.team3494.robot.commands.climb.Climb
@@ -113,7 +115,7 @@

E

execute() - Method in class org.usfirst.frc.team3494.robot.commands.intake.SwitchPosition
 
-A C D E G H I K L M O P R S T U V W X 
+A C D E F G H I K L M O P R S T U V W X 
diff --git a/docs/index-files/index-5.html b/docs/index-files/index-5.html index 396f74a..c4b62aa 100644 --- a/docs/index-files/index-5.html +++ b/docs/index-files/index-5.html @@ -2,9 +2,9 @@ - -G-Index - + +F-Index + @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@ + + + + + + + + + +
+
org.usfirst.frc.team3494.robot
+

Class AutoGenerator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.usfirst.frc.team3494.robot.AutoGenerator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class AutoGenerator
    +extends java.lang.Object
    +
    Class containing methods that return valid lists to pass to + ConstructedAuto.
    +
    +
    Since:
    +
    0.0.3
    +
    See Also:
    +
    ConstructedAuto
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      AutoGenerator() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static java.util.ArrayList<edu.wpi.first.wpilibj.command.Command>autoOne() +
      Test method.
      +
      static java.util.ArrayList<edu.wpi.first.wpilibj.command.Command>crossBaseLine() +
      Drives to the baseline and earns us five points (hopefully.)
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AutoGenerator

        +
        public AutoGenerator()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        autoOne

        +
        public static java.util.ArrayList<edu.wpi.first.wpilibj.command.Command> autoOne()
        +
        Test method. Drives to XY (36, 36) (inches).
        +
        +
        Returns:
        +
        A list of commands suitable for use with + ConstructedAuto.
        +
        Since:
        +
        0.0.3
        +
        See Also:
        +
        ConstructedAuto, +XYDrive
        +
        +
      • +
      + + + +
        +
      • +

        crossBaseLine

        +
        public static java.util.ArrayList<edu.wpi.first.wpilibj.command.Command> crossBaseLine()
        +
        Drives to the baseline and earns us five points (hopefully.)
        +
        +
        Returns:
        +
        A list of commands suitable for use with + ConstructedAuto.
        +
        Since:
        +
        0.0.3
        +
        See Also:
        +
        DistanceDrive
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/org/usfirst/frc/team3494/robot/DriveDirections.html b/docs/org/usfirst/frc/team3494/robot/DriveDirections.html index 05e40d6..ea22c7b 100644 --- a/docs/org/usfirst/frc/team3494/robot/DriveDirections.html +++ b/docs/org/usfirst/frc/team3494/robot/DriveDirections.html @@ -2,9 +2,9 @@ - + DriveDirections - + @@ -49,7 +49,7 @@
diff --git a/docs/org/usfirst/frc/team3494/robot/commands/drive/package-tree.html b/docs/org/usfirst/frc/team3494/robot/commands/drive/package-tree.html index 873db61..8578738 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/drive/package-tree.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/drive/package-tree.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands.drive Class Hierarchy - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/drive/package-use.html b/docs/org/usfirst/frc/team3494/robot/commands/drive/package-use.html index 8c3b6f9..955c0fd 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/drive/package-use.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/drive/package-use.html @@ -2,9 +2,9 @@ - + Uses of Package org.usfirst.frc.team3494.robot.commands.drive - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.html index 9833bfd..8ab7e30 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/RunIntake.html @@ -2,9 +2,9 @@ - + RunIntake - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/SwitchPosition.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/SwitchPosition.html index 9879bec..f0e2db6 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/SwitchPosition.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/SwitchPosition.html @@ -2,9 +2,9 @@ - + SwitchPosition - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/RunIntake.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/RunIntake.html index 31be1fb..3b56a97 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/RunIntake.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/RunIntake.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.commands.intake.RunIntake - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/SwitchPosition.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/SwitchPosition.html index ae3d319..0f73985 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/SwitchPosition.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/class-use/SwitchPosition.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.commands.intake.SwitchPosition - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-frame.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-frame.html index d566f35..8dea1fd 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-frame.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-frame.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands.intake - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-summary.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-summary.html index 363ca5f..c0fce83 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-summary.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-summary.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands.intake - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-tree.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-tree.html index 12f9023..9aae09e 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-tree.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-tree.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands.intake Class Hierarchy - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-use.html b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-use.html index 3ea31ac..06c84e6 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/intake/package-use.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/intake/package-use.html @@ -2,9 +2,9 @@ - + Uses of Package org.usfirst.frc.team3494.robot.commands.intake - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/package-frame.html b/docs/org/usfirst/frc/team3494/robot/commands/package-frame.html index ffb1898..dc65e03 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/package-frame.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/package-frame.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/package-summary.html b/docs/org/usfirst/frc/team3494/robot/commands/package-summary.html index 43e1f8d..57412ae 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/package-summary.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/package-summary.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/package-tree.html b/docs/org/usfirst/frc/team3494/robot/commands/package-tree.html index fce4a98..7a0bd78 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/package-tree.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/package-tree.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.commands Class Hierarchy - + diff --git a/docs/org/usfirst/frc/team3494/robot/commands/package-use.html b/docs/org/usfirst/frc/team3494/robot/commands/package-use.html index fd155f1..2a98938 100644 --- a/docs/org/usfirst/frc/team3494/robot/commands/package-use.html +++ b/docs/org/usfirst/frc/team3494/robot/commands/package-use.html @@ -2,9 +2,9 @@ - + Uses of Package org.usfirst.frc.team3494.robot.commands - + diff --git a/docs/org/usfirst/frc/team3494/robot/package-frame.html b/docs/org/usfirst/frc/team3494/robot/package-frame.html index 5ddf8d4..c5c4120 100644 --- a/docs/org/usfirst/frc/team3494/robot/package-frame.html +++ b/docs/org/usfirst/frc/team3494/robot/package-frame.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot - + @@ -13,6 +13,7 @@

Classes

    +
  • AutoGenerator
  • OI
  • Robot
  • RobotMap
  • diff --git a/docs/org/usfirst/frc/team3494/robot/package-summary.html b/docs/org/usfirst/frc/team3494/robot/package-summary.html index 49d194d..b746be5 100644 --- a/docs/org/usfirst/frc/team3494/robot/package-summary.html +++ b/docs/org/usfirst/frc/team3494/robot/package-summary.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot - + @@ -83,13 +83,20 @@

    Package org.usfirst.frc.team3494.robot +AutoGenerator + +
    Class containing methods that return valid lists to pass to + ConstructedAuto.
    + + + OI
    This class is the glue that binds the controls on the physical operator interface to the commands and command groups that allow control of the robot.
    - + Robot
    The VM is configured to automatically run this class, and to call the @@ -97,7 +104,7 @@

    Package org.usfirst.frc.team3494.robot - + RobotMap
    The RobotMap is a mapping from the ports sensors and actuators are wired into diff --git a/docs/org/usfirst/frc/team3494/robot/package-tree.html b/docs/org/usfirst/frc/team3494/robot/package-tree.html index f882ba4..6c3fc56 100644 --- a/docs/org/usfirst/frc/team3494/robot/package-tree.html +++ b/docs/org/usfirst/frc/team3494/robot/package-tree.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot Class Hierarchy - + @@ -81,6 +81,7 @@

    Class Hierarchy

    • java.lang.Object
        +
      • org.usfirst.frc.team3494.robot.AutoGenerator
      • org.usfirst.frc.team3494.robot.OI
      • edu.wpi.first.wpilibj.RobotBase
          diff --git a/docs/org/usfirst/frc/team3494/robot/package-use.html b/docs/org/usfirst/frc/team3494/robot/package-use.html index 1e11ae1..52b40cf 100644 --- a/docs/org/usfirst/frc/team3494/robot/package-use.html +++ b/docs/org/usfirst/frc/team3494/robot/package-use.html @@ -2,9 +2,9 @@ - + Uses of Package org.usfirst.frc.team3494.robot - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/Climber.html b/docs/org/usfirst/frc/team3494/robot/subsystems/Climber.html index 0fc1fd0..eb5835d 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/Climber.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/Climber.html @@ -2,9 +2,9 @@ - + Climber - + @@ -145,7 +145,11 @@

          Field Summary

          Field and Description -private edu.wpi.first.wpilibj.TalonSRX +private boolean +driveTrainMode  + + +private edu.wpi.first.wpilibj.Talon motor  @@ -234,10 +238,19 @@

          Field Detail

          -
            +
            • motor

              -
              private edu.wpi.first.wpilibj.TalonSRX motor
              +
              private edu.wpi.first.wpilibj.Talon motor
              +
            • +
            + + + +
              +
            • +

              driveTrainMode

              +
              private boolean driveTrainMode
            diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.html b/docs/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.html index da4ede7..0b9e026 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/Drivetrain.html @@ -2,9 +2,9 @@ - + Drivetrain - + @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10}; +var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -184,8 +184,16 @@

            Field Summary

            private edu.wpi.first.wpilibj.Encoder +encLeft  + + +private edu.wpi.first.wpilibj.Encoder encRight  + +private static double +RAMP  + edu.wpi.first.wpilibj.RobotDrive wpiDrive @@ -233,33 +241,37 @@

            Method Summary

            double +getLeftDistance(UnitTypes unit)  + + +double getRightDistance(UnitTypes unit)
            Gets the distance the right encoder has counted in the specified unit.
            - + void initDefaultCommand()  - + void resetRight()
            Resets the encoder on the right side of the drivetrain.
            - + void setAll(double speed)
            Sets all motors on a subsystem to a given speed.
            - + void stopAll()
            Stop all motors on the subsystem.
            - + void TankDrive(double left, double right) @@ -399,12 +411,30 @@

            wpiDrive

            -
              +
              • encRight

                private edu.wpi.first.wpilibj.Encoder encRight
              + + + +
                +
              • +

                encLeft

                +
                private edu.wpi.first.wpilibj.Encoder encLeft
                +
              • +
              + + + +
                +
              • +

                RAMP

                +
                private static double RAMP
                +
              • +
            @@ -499,6 +529,15 @@

            getRightDistance

          + + + +
            +
          • +

            getLeftDistance

            +
            public double getLeftDistance(UnitTypes unit)
            +
          • +
          diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/IMotorizedSubsystem.html b/docs/org/usfirst/frc/team3494/robot/subsystems/IMotorizedSubsystem.html index af2561c..1300408 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/IMotorizedSubsystem.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/IMotorizedSubsystem.html @@ -2,9 +2,9 @@ - + IMotorizedSubsystem - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/Intake.html b/docs/org/usfirst/frc/team3494/robot/subsystems/Intake.html index 7d1b616..f183df3 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/Intake.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/Intake.html @@ -2,9 +2,9 @@ - + Intake - + @@ -145,7 +145,7 @@

          Field Summary

          Field and Description -private edu.wpi.first.wpilibj.TalonSRX +private edu.wpi.first.wpilibj.Talon inMotor
          Talon that controls the intake.
          @@ -159,7 +159,7 @@

          Field Summary

          piston  -private edu.wpi.first.wpilibj.TalonSRX +private edu.wpi.first.wpilibj.Talon upMotor  @@ -261,7 +261,7 @@

          Field Detail

          • inMotor

            -
            private edu.wpi.first.wpilibj.TalonSRX inMotor
            +
            private edu.wpi.first.wpilibj.Talon inMotor
            Talon that controls the intake. Thankfully there's only one.
            See Also:
            @@ -275,7 +275,7 @@

            inMotor

            • upMotor

              -
              private edu.wpi.first.wpilibj.TalonSRX upMotor
              +
              private edu.wpi.first.wpilibj.Talon upMotor
            diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/Kompressor.html b/docs/org/usfirst/frc/team3494/robot/subsystems/Kompressor.html index b36c409..3f993ac 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/Kompressor.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/Kompressor.html @@ -2,9 +2,9 @@ - + Kompressor - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/Turret.html b/docs/org/usfirst/frc/team3494/robot/subsystems/Turret.html index 89479e1..52b65d0 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/Turret.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/Turret.html @@ -2,9 +2,9 @@ - + Turret - + @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10}; +var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -222,14 +222,18 @@

            Method Summary

            void +
            shoot(double power)  + + +void stopAll()
            Stop all motors on the subsystem.
            - + void turnTurret(DriveDirections dir) -
            Turns the turret at a hardcoded speed in the specified direction.
            +
            Turns the turret at a hard-coded speed in the specified direction.
            @@ -408,11 +412,11 @@

            getDistance

            -
              +
              • turnTurret

                public void turnTurret(DriveDirections dir)
                -
                Turns the turret at a hardcoded speed in the specified direction.
                +
                Turns the turret at a hard-coded speed in the specified direction.
                Parameters:
                dir - The direction to turn in. Defaults to right if you put in @@ -420,6 +424,15 @@

                turnTurret

              + + + +
                +
              • +

                shoot

                +
                public void shoot(double power)
                +
              • +
          • diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/TurretEncoders.html b/docs/org/usfirst/frc/team3494/robot/subsystems/TurretEncoders.html index 7b6a4c1..1a43a44 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/TurretEncoders.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/TurretEncoders.html @@ -2,9 +2,9 @@ - + TurretEncoders - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Climber.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Climber.html index 093286f..56288bf 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Climber.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Climber.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.subsystems.Climber - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Drivetrain.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Drivetrain.html index 33b9a97..31fb2e1 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Drivetrain.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Drivetrain.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.subsystems.Drivetrain - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/IMotorizedSubsystem.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/IMotorizedSubsystem.html index b5bdfac..453ae05 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/IMotorizedSubsystem.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/IMotorizedSubsystem.html @@ -2,9 +2,9 @@ - + Uses of Interface org.usfirst.frc.team3494.robot.subsystems.IMotorizedSubsystem - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Intake.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Intake.html index e7c5993..1723cfc 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Intake.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Intake.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.subsystems.Intake - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Kompressor.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Kompressor.html index 4aaed59..a9275c1 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Kompressor.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Kompressor.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.subsystems.Kompressor - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Turret.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Turret.html index 0d61bd2..2660407 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Turret.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/Turret.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.subsystems.Turret - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/TurretEncoders.html b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/TurretEncoders.html index c5c6243..9bd2e61 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/TurretEncoders.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/class-use/TurretEncoders.html @@ -2,9 +2,9 @@ - + Uses of Class org.usfirst.frc.team3494.robot.subsystems.TurretEncoders - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/package-frame.html b/docs/org/usfirst/frc/team3494/robot/subsystems/package-frame.html index 9e40c1f..b94461f 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/package-frame.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/package-frame.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.subsystems - + diff --git a/docs/org/usfirst/frc/team3494/robot/subsystems/package-summary.html b/docs/org/usfirst/frc/team3494/robot/subsystems/package-summary.html index c86d944..eb25e61 100644 --- a/docs/org/usfirst/frc/team3494/robot/subsystems/package-summary.html +++ b/docs/org/usfirst/frc/team3494/robot/subsystems/package-summary.html @@ -2,9 +2,9 @@ - + org.usfirst.frc.team3494.robot.subsystems - + @@ -44,7 +44,7 @@