Skip to content

Commit

Permalink
[#477] Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MattD8957 committed Mar 23, 2024
1 parent df1b6c4 commit cb8eda3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class RobotContainer extends LightningContainer {
private Flywheel flywheel;
private Pivot pivot;
private Indexer indexer;
// private Climber climber;
private Climber climber;
LEDs leds;
Orchestra sing;

Expand Down Expand Up @@ -129,7 +129,7 @@ protected void initializeSubsystems() {
flywheel = new Flywheel();
pivot = Constants.isMercury() ? new PivotMercury() : new PivotRhapsody();
indexer = new Indexer(collector);
// climber = new Climber();
climber = new Climber();
leds = new LEDs();
sing = new Orchestra();

Expand Down Expand Up @@ -162,7 +162,7 @@ protected void initializeNamedCommands() {
NamedCommands.registerCommand("Smart-Shoot",
new SmartShoot(flywheel, pivot, drivetrain, indexer, leds)
.alongWith(leds.enableState(LED_STATES.SHOOTING).withTimeout(0.5)));
NamedCommands.registerCommand("preAim", new preAim(flywheel, pivot, indexer, drivetrain));
NamedCommands.registerCommand("preAim", new preAim(flywheel, pivot, drivetrain));
NamedCommands.registerCommand("Chase-Pieces",
new ChasePieces(drivetrain, collector, indexer, pivot, flywheel, limelights));
NamedCommands.registerCommand("Smart-Collect",
Expand Down Expand Up @@ -351,7 +351,7 @@ protected void configureDefaultCommands() {
// () -> -coPilot.getRightY(),
// coPilot::getYButton).deadlineWith(leds.enableState(LED_STATES.CLIMBING)));

// climber.setDefaultCommand(new ManualClimb(() -> -coPilot.getLeftY(), () -> -coPilot.getRightY(), climber));
climber.setDefaultCommand(new ManualClimb(() -> -coPilot.getLeftY(), () -> -coPilot.getRightY(), climber));
}

protected Command getAutonomousCommand() {
Expand Down
29 changes: 10 additions & 19 deletions src/main/java/frc/robot/command/shoot/preAim.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@
import frc.robot.Constants;
import frc.robot.Constants.ShooterConstants;
import frc.robot.subsystems.Flywheel;
import frc.robot.subsystems.Indexer;
import frc.robot.subsystems.Pivot;
import frc.robot.subsystems.Swerve;

public class preAim extends Command {

private Flywheel flywheel;
private Pivot pivot;
private Indexer indexer;
private Swerve drivetrain;

public preAim(Flywheel flywheel, Pivot pivot, Indexer indexer, Swerve drivetrain) {
public preAim(Flywheel flywheel, Pivot pivot, Swerve drivetrain) {
this.flywheel = flywheel;
this.pivot = pivot;
this.indexer = indexer;
this.drivetrain = drivetrain;

addRequirements(flywheel, pivot, indexer);
addRequirements(flywheel, pivot);
}

@Override
Expand All @@ -34,12 +31,6 @@ public void execute() {
double distance = drivetrain.distanceToSpeaker();
pivot.setTargetAngle(calculateTargetAngle(distance));
flywheel.setAllMotorsRPM(calculateTargetRPM(distance));
if(indexer.getExitBeamBreakState()) {
indexer.indexDown();
} else {
indexer.stop();
}

}

@Override
Expand All @@ -59,10 +50,10 @@ public boolean isFinished() {
* @return Angle to set pivot to
*/
public double calculateTargetAngle(double distance) {
if(Constants.isMercury()){
return ShooterConstants.TUBE_ANGLE_MAP.get(distance);
}
return ShooterConstants.STEALTH_ANGLE_MAP.get(distance);
if (Constants.isMercury()) {
return ShooterConstants.TUBE_ANGLE_MAP.get(distance);
}
return ShooterConstants.STEALTH_ANGLE_MAP.get(distance);
}

/**
Expand All @@ -72,9 +63,9 @@ public double calculateTargetAngle(double distance) {
* @return RPM to set the Flywheels
*/
public double calculateTargetRPM(double distance) {
if(Constants.isMercury()){
return ShooterConstants.TUBE_SPEED_MAP.get(distance);
}
return ShooterConstants.STEALTH_SPEED_MAP.get(distance);
if (Constants.isMercury()) {
return ShooterConstants.TUBE_SPEED_MAP.get(distance);
}
return ShooterConstants.STEALTH_SPEED_MAP.get(distance);
}
}

0 comments on commit cb8eda3

Please sign in to comment.