-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
196 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<factorypath> | ||
<factorypathentry kind="EXTJAR" id="/Users/rohangodha/.gradle/caches/modules-2/files-2.1/org.littletonrobotics.akit.junction/junction-autolog/3.0.0/abaf89ad1ac7acc95dbc0d3f0785a39acf98dd0e/junction-autolog-3.0.0.jar" enabled="true" runInBatchMode="false"/> | ||
<factorypathentry kind="EXTJAR" id="/Users/rohangodha/.gradle/caches/modules-2/files-2.1/com.squareup/javapoet/1.13.0/d6562d385049f35eb50403fa86bb11cce76b866a/javapoet-1.13.0.jar" enabled="true" runInBatchMode="false"/> | ||
</factorypath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package frc.robot.subsystems.intake; | ||
|
||
import org.littletonrobotics.junction.Logger; | ||
import frc.robot.Constants.IntakeConstants; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class Intake extends SubsystemBase { | ||
public final IntakeIO io; | ||
public final IntakeIOInputsAutoLogged inputs = new IntakeIOInputsAutoLogged(); | ||
|
||
public Intake(IntakeIO io) { | ||
this.io = io; | ||
} | ||
|
||
@Override | ||
public void periodic() { | ||
io.updateInputs(inputs); | ||
Logger.processInputs("Intake", inputs); | ||
} | ||
|
||
public void turnOn() { | ||
io.setPower(IntakeConstants.intakeOnPower); | ||
} | ||
|
||
public void turnOff() { | ||
io.setPower(0.0); | ||
} | ||
|
||
public Command on() { | ||
return new InstantCommand(this::turnOn, this); | ||
} | ||
|
||
public Command off() { | ||
return new InstantCommand(this::turnOff, this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package frc.robot.subsystems.intake; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
public interface IntakeIO { | ||
@AutoLog | ||
public static class IntakeIOInputs { | ||
public double current = 0.0; | ||
} | ||
|
||
public default void updateInputs(IntakeIOInputs inputs) {} | ||
|
||
public default void setPower(double power) {} | ||
|
||
public default void setVoltage(double voltage) {} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/frc/robot/subsystems/intake/IntakeIOReal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package frc.robot.subsystems.intake; | ||
|
||
import com.ctre.phoenix6.BaseStatusSignal; | ||
import com.ctre.phoenix6.StatusSignal; | ||
import com.ctre.phoenix6.hardware.TalonFX; | ||
import frc.robot.Constants.IntakeConstants; | ||
|
||
public class IntakeIOReal implements IntakeIO { | ||
private final TalonFX motor; | ||
private final StatusSignal<Double> current; | ||
|
||
public IntakeIOReal() { | ||
motor = new TalonFX(IntakeConstants.intakeCANId); | ||
current = motor.getStatorCurrent(); | ||
|
||
BaseStatusSignal.setUpdateFrequencyForAll(20.0, current); | ||
motor.optimizeBusUtilization(); | ||
} | ||
|
||
@Override | ||
public void updateInputs(IntakeIO.IntakeIOInputs inputs) { | ||
BaseStatusSignal.refreshAll(current); | ||
inputs.current = current.getValue(); | ||
} | ||
|
||
@Override | ||
public void setPower(double power) { | ||
motor.set(power); | ||
} | ||
|
||
@Override | ||
public void setVoltage(double voltage) { | ||
motor.setVoltage(voltage); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package frc.robot.subsystems.intake; | ||
|
||
// TODO | ||
public class IntakeIOSim implements IntakeIO { | ||
} |