Skip to content

Commit

Permalink
Algae code (Untested, WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
KPatel008 committed Jan 18, 2025
1 parent 404d66c commit a583a5d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ private void configureBindings() {
joystick.rightBumper().onTrue(s_Elevator.goToL3()).onFalse(s_Elevator.stop());
joystick.leftTrigger().onTrue(s_Elevator.goToL4()).onFalse(s_Elevator.stop());

joystick.povUp().whileTrue(s_Algae.shootAlgae()).onFalse(s_Algae.stop());
joystick.povUp().whileTrue(s_Algae.shootAlgae


()).onFalse(s_Algae.stop());
joystick.povDown().whileTrue(s_Algae.intake()).onFalse(s_Algae.stop());

// joystick.povUp().whileTrue(s_Elevator.moveUp()).onFalse(s_Elevator.stop());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/subsystems/algae/Algae.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public Algae(AlgaeIO io) {
}

public Command shootAlgae() {
return this.run(() -> m_io.setSpeed(-0.1));
return this.runOnce(() -> m_io.setSpeed(1));
}

public Command stop() {
return this.run(() -> m_io.setSpeed(0));
return this.runOnce(() -> m_io.setSpeed(0));
}

public Command intake() {
return this.run(() -> m_io.setSpeed(1));
return this.runOnce(() -> m_io.setSpeed(-1));
}
}

4 changes: 3 additions & 1 deletion src/main/java/frc/robot/subsystems/algae/AlgaeIO.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package frc.robot.subsystems.algae;

import org.littletonrobotics.junction.AutoLog;

public interface AlgaeIO {

@AutoLog
public static class AlgaeIOInputs {
public double speed = 0.0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/elevator/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Elevator extends SubsystemBase {
private final double L1Setpoint = 29;
private final double L2Setpoint = 32.5;
private final double L3Setpoint = 51.5;
private final double L4Setpoint = 76;
private final double L4Setpoint = 75;
//inch to rotations of the motor
final double m_gearRatio = 0.5 * (1d / (1.75100 * Math.PI)) * ( 2d / 3d ) * 25;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public ElevatorIOTalonFX() {
final TalonFXConfiguration elevatorMotorConfig = new TalonFXConfiguration();
final MotorOutputConfigs outputConfigs = new MotorOutputConfigs();
outputConfigs.Inverted = InvertedValue.Clockwise_Positive;
outputConfigs.NeutralMode = NeutralModeValue.Brake;
elevatorMotorConfig.CurrentLimits.SupplyCurrentLimit = 40.0;
elevatorMotorConfig.CurrentLimits.SupplyCurrentLimitEnable = true;
// in init function, set slot 0 gains
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/shooter/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public Command shootL2() {
}

public Command shootTrough() {
return this.run(() -> m_io.setSpeed(-0.1));
return this.run(() -> m_io.setSpeed(-0.2));
}

public Command stop() {
Expand Down

0 comments on commit a583a5d

Please sign in to comment.