diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index ac2f0b9..5d7b919 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -99,7 +99,7 @@ public class Ports { } public final class ShooterConstants { - // Constants for the Shooter + // Constants for the Shooter public static final Angle ANGLE_TOLERANCE = Rotations.of(0.01); public static final AngularVelocity ANGLE_VELOCITY_TOLERANCE = RotationsPerSecond.of(0.01); public static final AngularVelocity CRUISE_VELOCITY = RotationsPerSecond.of(204); @@ -112,9 +112,14 @@ public final class ShooterConstants { public static final Angle MAX_ANGLE = Rotations.of(10.0); public static final Angle STARTING_ANGLE = Rotations.of(0.0); public static final Distance WHEEL_RADIUS = Meters.of(0.5); - public static final RotaryMechCharacteristics CONSTANTS = RotaryMechCharacteristics(OFFSET, WHEEL_RADIUS, MIN_ANGLE, MAX_ANGLE, STARTING_ANGLE); + public static final RotaryMechCharacteristics CONSTANTS = + RotaryMechCharacteristics(OFFSET, WHEEL_RADIUS, MIN_ANGLE, MAX_ANGLE, STARTING_ANGLE); + public static final double IDLE_SPEED_RPM = (1.0); + public static final double HUB_SPEED_RPM = (1.0); + public static final double TOWER_SPEED_RPM = (1.0); + public static final double DEFAULT_SPEED_RPM = (1.0); } - + public static final int CANDLE_ID = 50; public class IntakeConstants { @@ -131,6 +136,7 @@ public class IntakeConstants { public static final RotaryMechCharacteristics CONSTANTS = new RotaryMechCharacteristics(OFFSET, WHEEL_RADIUS, MIN_ANGLE, MAX_ANGLE, STARTING_ANGLE); } + public class ClimberConstants { public static final Distance TOLERANCE = Inches.of(0.1); public static final double GEARING = (5.0 / 1.0); @@ -139,6 +145,12 @@ public class ClimberConstants { public static final Distance STARTING_DISTANCE = Inches.of(0.0); public static final Distance DRUM_RADIUS = Inches.of(2.0); public static final DistanceAngleConverter CONVERTER = new DistanceAngleConverter(DRUM_RADIUS); - public static final LinearMechCharacteristics CHARACTERISTICS = new LinearMechCharacteristics(new Translation3d(0.0, 0.0, 0.0), MIN_DISTANCE, MAX_DISTANCE, STARTING_DISTANCE, CONVERTER); + public static final LinearMechCharacteristics CHARACTERISTICS = + new LinearMechCharacteristics( + new Translation3d(0.0, 0.0, 0.0), + MIN_DISTANCE, + MAX_DISTANCE, + STARTING_DISTANCE, + CONVERTER); } } diff --git a/src/main/java/frc/robot/subsystems/hood/hood.java b/src/main/java/frc/robot/subsystems/hood/hood.java new file mode 100644 index 0000000..182549f --- /dev/null +++ b/src/main/java/frc/robot/subsystems/hood/hood.java @@ -0,0 +1,15 @@ +package frc.robot.subsystems.hood; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.lib.W8.mechanisms.linear.LinearMechanism; + +public class hood extends SubsystemBase { + private final LinearMechanism _io; + + public hood(LinearMechanism io) { + _io = io; + } + + @Override + public void periodic() {} +} diff --git a/src/main/java/frc/robot/subsystems/hopper/Hopper.java b/src/main/java/frc/robot/subsystems/hopper/Hopper.java index 00f8d5f..2ba37f6 100644 --- a/src/main/java/frc/robot/subsystems/hopper/Hopper.java +++ b/src/main/java/frc/robot/subsystems/hopper/Hopper.java @@ -2,22 +2,20 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.lib.W8.mechanisms.flywheel.FlywheelMechanism; -import frc.robot.Constants; public class Hopper extends SubsystemBase { -private FlywheelMechanism _io; + private FlywheelMechanism _io; -public Hopper(FlywheelMechanism io) { -_io = io; -} + public Hopper(FlywheelMechanism io) { + _io = io; + } -public void setGoal(double position) { - Distance positionInches = Inches.of(position); - _io.runPosition(HopperConstants.CONVERTER.toAngle(positionInches), PIDSlot.SLOT_0); -} + public void setGoal(double position) { + Distance positionInches = Inches.of(position); + _io.runPosition(HopperConstants.CONVERTER.toAngle(positionInches), PIDSlot.SLOT_0); + } @Override public void periodic() {} - -} \ No newline at end of file +} diff --git a/src/main/java/frc/robot/subsystems/shooter/Shooter.java b/src/main/java/frc/robot/subsystems/shooter/Shooter.java index 9f7116b..5798a01 100644 --- a/src/main/java/frc/robot/subsystems/shooter/Shooter.java +++ b/src/main/java/frc/robot/subsystems/shooter/Shooter.java @@ -2,6 +2,17 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.lib.W8.mechanisms.flywheel.FlywheelMechanism; +import frc.robot.Constants.ShooterConstants; + +import static edu.wpi.first.units.Units.Inches; +import static edu.wpi.first.units.Units.Meters; +import static edu.wpi.first.units.Units.Rotations; +import static edu.wpi.first.units.Units.RotationsPerSecond; +import static edu.wpi.first.units.Units.RotationsPerSecondPerSecond; +import static edu.wpi.first.units.Units.Second; +import edu.wpi.first.units.Units; +import edu.wpi.first.units.measure.AngularAcceleration; +import edu.wpi.first.units.measure.AngularVelocity; public class Shooter extends SubsystemBase { private FlywheelMechanism _io; @@ -10,6 +21,20 @@ public Shooter(FlywheelMechanism io) { _io = io; } + public enum State { + OFF(Units.RevolutionsPerSecond.of(0.0)), + IDLE(Units.RevolutionsPerSecond.of(ShooterConstants.IDLE_SPEED_RPM/60)), + SHOOT_FROM_HUB(Units.RevolutionsPerSecond.of(ShooterConstants.HUB_SPEED_RPM/60)), + SHOOT_FROM_TOWER(Units.RevolutionsPerSecond.of(ShooterConstants.TOWER_SPEED_RPM/60)), + SHOOT(Units.RevolutionsPerSecond.of(ShooterConstants.DEFAULT_SPEED_RPM/60)), + SHOOT_ON_MOVE(Units.RevolutionsPerSecond.of(ShooterConstants.DEFAULT_SPEED_RPM/60)); + + private final AngularVelocity stateVelocity; + State(AngularVelocity stateVelocity) { + this.stateVelocity = stateVelocity; + } + } + @Override public void periodic() {} }