Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into offseason-base
Browse files Browse the repository at this point in the history
  • Loading branch information
krypto-bot-2539[bot] committed Feb 6, 2025
2 parents 8a71912 + 55a069e commit d178c77
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/constants/GripperConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ public class GripperConstants {
new CurrentLimitsConfigs().withStatorCurrentLimit(50);

public static final String canbus = "CANivore";

public static final int gripperSensorChannel = 60;
}
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/constants/IntakeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public class IntakeConstants {
public static final String canbusFlipper = "CANivore";

public static final CurrentLimitsConfigs currentLimit = new CurrentLimitsConfigs();

public static final int intakeGPSensor = 99;
}
1 change: 1 addition & 0 deletions src/main/java/frc/robot/subsystems/gripper/GripperIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class GripperIOInputs {
public double voltage = 0;
public double temperature = 0;
public double current = 0;
public boolean sensor = false;
}

public void setVoltage(double voltage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.NeutralModeValue;
import edu.wpi.first.wpilibj.DigitalInput;
import frc.robot.constants.GripperConstants;

public class GripperIOFalcon implements GripperIO {
private final TalonFX armRoller = new TalonFX(GripperConstants.id, GripperConstants.canbus);

private DigitalInput gripperGPSensor = new DigitalInput(GripperConstants.gripperSensorChannel);

public GripperIOFalcon() {
armRoller.setPosition(0);

Expand All @@ -23,6 +26,7 @@ public void updateInputs(GripperIOInputs inputs) {
inputs.voltage = armRoller.getMotorVoltage().getValueAsDouble();
inputs.current = armRoller.getStatorCurrent().getValueAsDouble();
inputs.temperature = armRoller.getDeviceTemp().getValueAsDouble();
inputs.sensor = gripperGPSensor.get();
}

public void setVoltage(double voltage) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/subsystems/gripper/GripperIOSim.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package frc.robot.subsystems.gripper;

import org.littletonrobotics.junction.networktables.LoggedNetworkBoolean;

public class GripperIOSim implements GripperIO {
public double voltage;
public double speed;
public LoggedNetworkBoolean gripperGPSensor =
new LoggedNetworkBoolean("Gripper Sensor Sim", true);

public void updateInputs(GripperIOInputs inputs) {
inputs.voltage = voltage;
inputs.speed = speed;
inputs.sensor = gripperGPSensor.get();
}

public void setVoltage(double voltage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ public Command setVoltage(double voltage) {
piviotIO.setVoltage(voltage);
});
}

public boolean hasPiece() {
return armrollerInputs.sensor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class IntakeRollerIOInputs {
public double voltage = 0;
public double temperature = 0;
public double current = 0;
public boolean sensor;
}

public void setVoltage(double voltage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package frc.robot.subsystems.intake;

import org.littletonrobotics.junction.networktables.LoggedNetworkBoolean;

public class IntakeRollerIOSim implements IntakeRollerIO {
public double voltage;
public double speed;

public LoggedNetworkBoolean intakeGPSensorBool =
new LoggedNetworkBoolean("Intake Sensor Sim", true);

public void updateInputs(IntakeRollerIOInputs inputs) {
inputs.voltage = voltage;
inputs.speed = speed;
inputs.sensor = intakeGPSensorBool.get();
}

public void setVoltage(double voltage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.NeutralModeValue;
import edu.wpi.first.wpilibj.DigitalInput;
import frc.robot.constants.IntakeConstants;

public class IntakeRollerTalonFX implements IntakeRollerIO {
private final TalonFX intakeroller =
new TalonFX(IntakeConstants.idRoller, IntakeConstants.canbusRoller);

private DigitalInput intakeGPSensor = new DigitalInput(IntakeConstants.intakeGPSensor);

public IntakeRollerTalonFX() {
intakeroller.setVoltage(0);

Expand All @@ -24,6 +27,7 @@ public void updateInputs(IntakeRollerIOInputs inputs) {
inputs.voltage = intakeroller.getMotorVoltage().getValueAsDouble();
inputs.temperature = intakeroller.getDeviceTemp().getValueAsDouble();
inputs.current = intakeroller.getStatorCurrent().getValueAsDouble();
inputs.sensor = intakeGPSensor.get();
}

public void setVoltage(double voltage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@ public Command openAndEject() {
public Command closeIntake() {
return run(() -> flipperIO.setClose());
}

public boolean hasPiece() {
return intakeInputs.sensor;
}
}

0 comments on commit d178c77

Please sign in to comment.