Skip to content

Commit

Permalink
Update flywheel speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
OakvilleDynamicsProgrammer committed Mar 6, 2024
1 parent 32b7e6d commit 624c997
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static class MechanismConstants {
public static final int FLYWHEEL_MOTOR_2 = 4;
public static final boolean FLYWHEEL_MOTOR_1_INVERTED = true;
public static final boolean FLYWHEEL_MOTOR_2_INVERTED = false;
public static final double FLYWHEEL_MOTOR_SPEED = 0.8;
public static final double FLYWHEEL_MOTOR_SPEED = 1.0;
public static final double FLYWHEEL_MOTOR_SPEED_SLOW = 0.15;
}
}
9 changes: 5 additions & 4 deletions src/main/java/frc/robot/commands/FlyWCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ public void initialize() {}
@Override
public void execute() {
// TODO: Change this to the correct button
if (ConveyorJoystick.getRawButton(3) == true) {
m_FlyWSubsystem.enableflywheel();
if (ConveyorJoystick.getRawButton(7) == true) {

Check warning on line 28 in src/main/java/frc/robot/commands/FlyWCommand.java

View workflow job for this annotation

GitHub Actions / qodana

Pointless boolean expression

`ConveyorJoystick.getRawButton(7) == true` can be simplified to 'ConveyorJoystick.getRawButton(7)'
m_FlyWSubsystem.enableflywheelfast();
// TODO: Change this to the correct button
} else if (ConveyorJoystick.getRawButton(4) == true) {
} else if (ConveyorJoystick.getRawButton(8) == true) {

Check warning on line 31 in src/main/java/frc/robot/commands/FlyWCommand.java

View workflow job for this annotation

GitHub Actions / qodana

Pointless boolean expression

`ConveyorJoystick.getRawButton(8) == true` can be simplified to 'ConveyorJoystick.getRawButton(8)'
m_FlyWSubsystem.reverseflywheel();
System.out.println("Conveyor Moving in Reverse");
} else if (ConveyorJoystick.getRawButton(9) == true) {

Check warning on line 34 in src/main/java/frc/robot/commands/FlyWCommand.java

View workflow job for this annotation

GitHub Actions / qodana

Pointless boolean expression

`ConveyorJoystick.getRawButton(9) == true` can be simplified to 'ConveyorJoystick.getRawButton(9)'
m_FlyWSubsystem.enableflywheelslow();
} else {
m_FlyWSubsystem.disableflywheel();
}
Expand All @@ -39,7 +41,6 @@ public void execute() {
@Override
public void end(boolean interrupted) {
m_FlyWSubsystem.disableflywheel();
m_FlyWSubsystem.enableflywheel();
}

@Override
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/frc/robot/subsystems/FlyWheel.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ public FlyWheel() {
}

/** Sets the flywheel motors to 100% power. */
public void enableflywheel() {
public void enableflywheelfast() {
flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED);
flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED);
}

/** Sets the flywheel motors to slow speed */
public void enableflywheelslow() {
flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW);
flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW);
}

/** Sets the flywheel motors to 0% power. */
public void disableflywheel() {
flywheelMotor1.set(0);
Expand All @@ -36,8 +42,8 @@ public void disableflywheel() {

/** Sets the flywheel motors to -100% power. (Reverse direction) */
public void reverseflywheel() {
flywheelMotor1.set(-MechanismConstants.FLYWHEEL_MOTOR_SPEED);
flywheelMotor2.set(-MechanismConstants.FLYWHEEL_MOTOR_SPEED);
flywheelMotor1.set(-MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW);
flywheelMotor2.set(-MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW);
}

@Override
Expand Down

0 comments on commit 624c997

Please sign in to comment.