Working over constants to make the new ALL_CAPS style
This commit is contained in:
@@ -37,22 +37,22 @@ public class Robot extends OpModeRobot {
|
|||||||
drive = new Drivetrain(true);
|
drive = new Drivetrain(true);
|
||||||
pusher = new Pusher();
|
pusher = new Pusher();
|
||||||
shooter = new Shooter();
|
shooter = new Shooter();
|
||||||
gamepad = new CommandGamepad(OIConstants.kDriverUSB);
|
gamepad = new CommandGamepad(OIConstants.DRIVER_USB);
|
||||||
|
|
||||||
drive.setDefaultCommand(drive.idle());
|
drive.setDefaultCommand(drive.idle());
|
||||||
pusher.setDefaultCommand(pusher.idle());
|
pusher.setDefaultCommand(pusher.idle());
|
||||||
shooter.setDefaultCommand(shooter.idle());
|
shooter.setDefaultCommand(shooter.idle());
|
||||||
|
|
||||||
strip = new PhysicalLEDStrip(LEDConstants.kLEDPWM, LEDConstants.kNumLEDs);
|
strip = new PhysicalLEDStrip(LEDConstants.LED_PWM, LEDConstants.NUM_LEDS);
|
||||||
|
|
||||||
manager = new AnimationManager(new PhysicalLEDStrip[] {strip});
|
manager = new AnimationManager(new PhysicalLEDStrip[] {strip});
|
||||||
|
|
||||||
rainbow = new FluidRainbow(strip, LEDConstants.kRainbowUpdateRate);
|
rainbow = new FluidRainbow(strip, LEDConstants.RAINBOW_UPDATE_RATE);
|
||||||
rainbow.start();
|
rainbow.start();
|
||||||
|
|
||||||
manager.registerAnimationForUpdate(rainbow);
|
manager.registerAnimationForUpdate(rainbow);
|
||||||
|
|
||||||
manager.start(LEDConstants.kAnimationManagerUpdateRate);
|
manager.start(LEDConstants.ANIMATION_MANAGER_UPDATE_RATE);
|
||||||
|
|
||||||
TunableRegistry.publish("Drive Tunables", drive);
|
TunableRegistry.publish("Drive Tunables", drive);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package first.robot.constants;
|
package first.robot.constants;
|
||||||
|
|
||||||
public class DrivetrainConstants {
|
public class DrivetrainConstants {
|
||||||
public static final int kFrontLeftPWM = 0;
|
public static final int FRONT_LEFT_PWM = 0;
|
||||||
public static final int kRearLeftPWM = 1;
|
public static final int REAR_LEFT_PWM = 1;
|
||||||
public static final int kFrontRightPWM = 2;
|
public static final int FRONT_RIGHT_PWM = 2;
|
||||||
public static final int kRearRightPWM = 3;
|
public static final int REAR_RIGHT_PWM = 3;
|
||||||
|
|
||||||
public static final double kSlowModeMultiplier = .75;
|
public static final double SLOW_MODE_MULTIPLIER = .75;
|
||||||
|
|
||||||
public static final boolean kInvertForwardBackward = true;
|
public static final boolean INVERT_FORWARD_BACKWARD = true;
|
||||||
public static final boolean kInvertLeftRight = true;
|
public static final boolean INVERT_LEFT_RIGHT = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package first.robot.constants;
|
package first.robot.constants;
|
||||||
|
|
||||||
public class LEDConstants {
|
public class LEDConstants {
|
||||||
public static final int kLEDPWM = 8;
|
public static final int LED_PWM = 8;
|
||||||
|
|
||||||
public static final int kNumLEDs = 19 * 2 + 12 * 2;
|
public static final int NUM_LEDS = 19 * 2 + 12 * 2;
|
||||||
|
|
||||||
public static final double kRainbowUpdateRate = .02;
|
public static final double RAINBOW_UPDATE_RATE = .02;
|
||||||
public static final double kBreathingUpdateRate = .03;
|
public static final double BREATHING_UPDATE_RATE = .03;
|
||||||
public static final double kBreathingMinPercentage = 25;
|
public static final double BREATHING_MIN_PERCENTAGE = 25;
|
||||||
public static final double kBreathingMaxPercentage = 100;
|
public static final double BREATHING_MAX_PERCENTAGE = 100;
|
||||||
public static final double kAnimationManagerUpdateRate = .01;
|
public static final double ANIMATION_MANAGER_UPDATE_RATE = .01;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package first.robot.constants;
|
package first.robot.constants;
|
||||||
|
|
||||||
public class OIConstants {
|
public class OIConstants {
|
||||||
public static final int kDriverUSB = 0;
|
public static final int DRIVER_USB = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package first.robot.constants;
|
|||||||
import org.wpilib.hardware.bus.SerialPort;
|
import org.wpilib.hardware.bus.SerialPort;
|
||||||
|
|
||||||
public class PusherConstants {
|
public class PusherConstants {
|
||||||
public static final int kBaudRate = 9600;
|
public static final int BAUD_RATE = 9600;
|
||||||
|
|
||||||
public static final SerialPort.Port kPort = SerialPort.Port.USB;
|
public static final SerialPort.Port PORT = SerialPort.Port.USB;
|
||||||
|
|
||||||
public static final String kStopString = "s0~";
|
public static final String STOP_STRING = "s0~";
|
||||||
public static final String kSpinString = "s-250~";
|
public static final String SPIN_STRING = "s-250~";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package first.robot.constants;
|
|||||||
import org.wpilib.hardware.bus.CANPort;
|
import org.wpilib.hardware.bus.CANPort;
|
||||||
|
|
||||||
public class ShooterConstants {
|
public class ShooterConstants {
|
||||||
public static final CANPort kShooterCANPort = CANPort.CAN_S0;
|
public static final CANPort SHOOTER_CAN_PORT = CANPort.CAN_S0;
|
||||||
public static final int kFrontShooterCAN = 1;
|
public static final int FRONT_SHOOTER_CAN = 1;
|
||||||
public static final int kRearShooterCAN = 2;
|
public static final int REAR_SHOOTER_CAN = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ public class Drivetrain implements Mechanism,ComplexTunable {
|
|||||||
private boolean slowMode;
|
private boolean slowMode;
|
||||||
|
|
||||||
public Drivetrain(boolean slowModeAtStartup) {
|
public Drivetrain(boolean slowModeAtStartup) {
|
||||||
frontLeft = new VictorSP(DrivetrainConstants.kFrontLeftPWM);
|
frontLeft = new VictorSP(DrivetrainConstants.FRONT_LEFT_PWM);
|
||||||
rearLeft = new VictorSP(DrivetrainConstants.kRearLeftPWM);
|
rearLeft = new VictorSP(DrivetrainConstants.REAR_LEFT_PWM);
|
||||||
frontRight = new VictorSP(DrivetrainConstants.kFrontRightPWM);
|
frontRight = new VictorSP(DrivetrainConstants.FRONT_RIGHT_PWM);
|
||||||
rearRight = new VictorSP(DrivetrainConstants.kRearRightPWM);
|
rearRight = new VictorSP(DrivetrainConstants.REAR_RIGHT_PWM);
|
||||||
|
|
||||||
frontLeft.addFollower(rearLeft);
|
frontLeft.addFollower(rearLeft);
|
||||||
frontRight.addFollower(rearRight);
|
frontRight.addFollower(rearRight);
|
||||||
@@ -51,8 +51,8 @@ public class Drivetrain implements Mechanism,ComplexTunable {
|
|||||||
public Command tankDrive(CommandGamepad gamepad) {
|
public Command tankDrive(CommandGamepad gamepad) {
|
||||||
return runRepeatedly(() -> {
|
return runRepeatedly(() -> {
|
||||||
drive.tankDrive(
|
drive.tankDrive(
|
||||||
(DrivetrainConstants.kInvertForwardBackward ? -1 : 1) * gamepad.getLeftY() * (slowMode ? DrivetrainConstants.kSlowModeMultiplier : 1),
|
(DrivetrainConstants.INVERT_FORWARD_BACKWARD ? -1 : 1) * gamepad.getLeftY() * (slowMode ? DrivetrainConstants.SLOW_MODE_MULTIPLIER : 1),
|
||||||
(DrivetrainConstants.kInvertLeftRight ? -1 : 1) * gamepad.getRightY() * (slowMode ? DrivetrainConstants.kSlowModeMultiplier : 1)
|
(DrivetrainConstants.INVERT_LEFT_RIGHT ? -1 : 1) * gamepad.getRightY() * (slowMode ? DrivetrainConstants.SLOW_MODE_MULTIPLIER : 1)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.named("Drivetrain.TankDrive");
|
.named("Drivetrain.TankDrive");
|
||||||
@@ -61,8 +61,8 @@ public class Drivetrain implements Mechanism,ComplexTunable {
|
|||||||
public Command arcadeDrive(CommandGamepad gamepad) {
|
public Command arcadeDrive(CommandGamepad gamepad) {
|
||||||
return runRepeatedly(() -> {
|
return runRepeatedly(() -> {
|
||||||
drive.arcadeDrive(
|
drive.arcadeDrive(
|
||||||
(DrivetrainConstants.kInvertForwardBackward ? -1 : 1) * gamepad.getLeftY() * (slowMode ? DrivetrainConstants.kSlowModeMultiplier : 1),
|
(DrivetrainConstants.INVERT_FORWARD_BACKWARD ? -1 : 1) * gamepad.getLeftY() * (slowMode ? DrivetrainConstants.SLOW_MODE_MULTIPLIER : 1),
|
||||||
(DrivetrainConstants.kInvertLeftRight ? -1 : 1) * gamepad.getLeftX() * (slowMode ? DrivetrainConstants.kSlowModeMultiplier : 1)
|
(DrivetrainConstants.INVERT_LEFT_RIGHT ? -1 : 1) * gamepad.getLeftX() * (slowMode ? DrivetrainConstants.SLOW_MODE_MULTIPLIER : 1)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.named("Drivetrain.ArcadeDrive");
|
.named("Drivetrain.ArcadeDrive");
|
||||||
|
|||||||
@@ -13,17 +13,17 @@ public class Pusher implements Mechanism {
|
|||||||
|
|
||||||
public Pusher() {
|
public Pusher() {
|
||||||
pusher = new SerialPort(
|
pusher = new SerialPort(
|
||||||
PusherConstants.kBaudRate,
|
PusherConstants.BAUD_RATE,
|
||||||
PusherConstants.kPort
|
PusherConstants.PORT
|
||||||
);
|
);
|
||||||
|
|
||||||
pusher.writeString(PusherConstants.kStopString);
|
pusher.writeString(PusherConstants.STOP_STRING);
|
||||||
pusher.flush();
|
pusher.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command spin() {
|
public Command spin() {
|
||||||
return run((coroutine) -> {
|
return run((coroutine) -> {
|
||||||
pusher.writeString(PusherConstants.kSpinString);
|
pusher.writeString(PusherConstants.SPIN_STRING);
|
||||||
pusher.flush();
|
pusher.flush();
|
||||||
})
|
})
|
||||||
.named("Pusher.Spin");
|
.named("Pusher.Spin");
|
||||||
@@ -31,7 +31,7 @@ public class Pusher implements Mechanism {
|
|||||||
|
|
||||||
public Command stop() {
|
public Command stop() {
|
||||||
return run((coroutine) -> {
|
return run((coroutine) -> {
|
||||||
pusher.writeString(PusherConstants.kStopString);
|
pusher.writeString(PusherConstants.STOP_STRING);
|
||||||
pusher.flush();
|
pusher.flush();
|
||||||
})
|
})
|
||||||
.named("Pusher.Stop");
|
.named("Pusher.Stop");
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ public class Shooter implements Mechanism {
|
|||||||
|
|
||||||
public Shooter() {
|
public Shooter() {
|
||||||
frontShooter = new SparkMax(
|
frontShooter = new SparkMax(
|
||||||
ShooterConstants.kShooterCANPort,
|
ShooterConstants.SHOOTER_CAN_PORT,
|
||||||
ShooterConstants.kFrontShooterCAN,
|
ShooterConstants.FRONT_SHOOTER_CAN,
|
||||||
MotorType.kBrushless
|
MotorType.kBrushless
|
||||||
);
|
);
|
||||||
|
|
||||||
rearShooter = new SparkMax(
|
rearShooter = new SparkMax(
|
||||||
ShooterConstants.kShooterCANPort,
|
ShooterConstants.SHOOTER_CAN_PORT,
|
||||||
ShooterConstants.kRearShooterCAN,
|
ShooterConstants.REAR_SHOOTER_CAN,
|
||||||
MotorType.kBrushless
|
MotorType.kBrushless
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user