diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index c896723..3f215c3 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -28,10 +28,9 @@ public static class HumanInput { } public static class CANMotor { - public static int RIGHT_DRIVE_A = 2; - public static int RIGHT_DRIVE_B = 3; + public static int RIGHT_DRIVE_A = 3; public static int LEFT_DRIVE_A = 4; - public static int LEFT_DRIVE_B = 5; + public static int EXTRA_MOTOR = -1; // TODO: set port } public static class PWM { @@ -87,12 +86,11 @@ public static class Component { public static EncoderPair chassisTalonEncoders; public static EncoderPair chassisCANCoders; public static Motor rightWheelA; - public static Motor rightWheelB; public static Motor leftWheelA; - public static Motor leftWheelB; public static SolenoidSubsystem solenoid; public static TankDrive chassis; public static CustomPIDController drivePID; + public static Motor extraMotor; } public static class Input { @@ -120,12 +118,11 @@ public RobotMap() { // Wheels CANTalonFX leftWheelATalon = new CANTalonFX(Port.CANMotor.LEFT_DRIVE_A); - CANTalonFX rightWheelATalon = new CANTalonFX(Port.CANMotor.RIGHT_DRIVE_B); + CANTalonFX rightWheelATalon = new CANTalonFX(Port.CANMotor.RIGHT_DRIVE_A); Component.rightWheelA = new Motor("rightWheelA", false, rightWheelATalon); - Component.rightWheelB = new Motor("rightWheelB", false, new CANTalonFX(Port.CANMotor.RIGHT_DRIVE_B)); Component.leftWheelA = new Motor("leftWheelA", true, leftWheelATalon); - Component.leftWheelB = new Motor("leftWheelB", true, new CANTalonFX(Port.CANMotor.LEFT_DRIVE_B)); + Component.extraMotor = new Motor("extraMotor", false, new CANTalonFX(Port.CANMotor.EXTRA_MOTOR)); // Wheel Encoders Component.leftWheelTalonEncoder = new CANTalonEncoder("Leftwheel", leftWheelATalon, true, @@ -147,8 +144,8 @@ public RobotMap() { Component.solenoid = new SolenoidSubsystem(Port.Pneumatics.SOLENOID.buildDoubleSolenoid()); // General Chassis - Component.chassis = new TankDrive("Blinky-Chassis", Component.leftWheelA, Component.leftWheelB, - Component.rightWheelA, Component.rightWheelB); + Component.chassis = new TankDrive("Blinky-Chassis", Component.leftWheelA, + Component.rightWheelA); Component.chassis.setDefaultCommand(new ChassisMove(Component.chassis, new NathanGain())); } } diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/Turn.java b/src/main/java/org/usfirst/frc4904/robot/commands/Turn.java new file mode 100644 index 0000000..06f5d18 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/Turn.java @@ -0,0 +1,18 @@ +package org.usfirst.frc4904.robot.commands; + +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; +import org.usfirst.frc4904.standard.subsystems.motor.Motor; + +/** + * Constantly turns motor at specified speed. + */ + +public class Turn extends MotorConstant { + public Turn(String name, Motor motor, double motorSpeed) { + super(name, motor, motorSpeed); + } + + public Turn(Motor motor, double motorSpeed) { + super(motor, motorSpeed); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/humaninterface/drivers/NathanGain.java b/src/main/java/org/usfirst/frc4904/robot/humaninterface/drivers/NathanGain.java index 0d3b902..c915687 100644 --- a/src/main/java/org/usfirst/frc4904/robot/humaninterface/drivers/NathanGain.java +++ b/src/main/java/org/usfirst/frc4904/robot/humaninterface/drivers/NathanGain.java @@ -3,6 +3,7 @@ import java.util.List; import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.robot.commands.Turn; import org.usfirst.frc4904.standard.LogKitten; import org.usfirst.frc4904.standard.LogKitten.KittenLevel; import org.usfirst.frc4904.standard.commands.Cancel; @@ -39,6 +40,10 @@ protected double scaleGain(double input, double gain, double exp) { public void bindCommands() { RobotMap.HumanInput.Driver.xbox.a.whenPressed(new SolenoidExtend(RobotMap.Component.solenoid)); RobotMap.HumanInput.Driver.xbox.b.whenPressed(new SolenoidRetract(RobotMap.Component.solenoid)); + RobotMap.HumanInput.Driver.xbox.dPad.down.whenPressed(new Turn(RobotMap.Component.extraMotor, 0.0/3.0)); // off + RobotMap.HumanInput.Driver.xbox.dPad.left.whenPressed(new Turn(RobotMap.Component.extraMotor, 1.0/3.0)); // slow + RobotMap.HumanInput.Driver.xbox.dPad.up.whenPressed(new Turn(RobotMap.Component.extraMotor, 2.0/3.0)); // medium + RobotMap.HumanInput.Driver.xbox.dPad.right.whenPressed(new Turn(RobotMap.Component.extraMotor, 3.0/3.0)); // max } @Override