-
Notifications
You must be signed in to change notification settings - Fork 0
IntakeExtension #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
IntakeExtension #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package frc.robot.subsystems.intake; | ||
|
|
||
| import static edu.wpi.first.units.Units.Volts; | ||
|
|
||
| import com.ctre.phoenix6.configs.TalonFXConfiguration; | ||
| import com.ctre.phoenix6.signals.InvertedValue; | ||
| import com.ctre.phoenix6.signals.NeutralModeValue; | ||
| import edu.wpi.first.wpilibj2.command.Command; | ||
| import edu.wpi.first.wpilibj2.command.Commands; | ||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
| import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine; | ||
| import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.*; | ||
| import frc.robot.components.rollers.RollerIO; | ||
| import frc.robot.components.rollers.RollerIOInputsAutoLogged; | ||
| import org.littletonrobotics.junction.Logger; | ||
|
|
||
| public class ExtensionSubsystem extends SubsystemBase { | ||
| public static final double GEAR_RATIO = 2.0; | ||
|
|
||
|
|
||
|
|
||
|
|
||
| private ExtensionIO io; | ||
| private ExtensionIOInputsAutoLogged inputs = new RollerIOInputsAutoLogged(); | ||
|
|
||
| private SysIdRoutine intakeRollerSysid = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this because it's sysid for the extension not the rollers. |
||
| new SysIdRoutine( | ||
| new Config(null, null, null, (state) -> Logger.recordOutput("Extension/SysID State", state)), | ||
| new Mechanism((volts) -> io.setExtensionVoltage(volts.in(Volts)), null, this)); | ||
|
|
||
| public ExtensionSubsystem(ExtensionIO io) { | ||
| this.io = io; | ||
| } | ||
|
|
||
| public void periodic() { | ||
| io.updateInputs(inputs); | ||
| Logger.processInputs("Extension", inputs); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe log these to |
||
| } | ||
|
|
||
| // TODO get actual values | ||
| public Command extend() { | ||
| return this.run(() -> io.setExtensionVoltage(5)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should probably be on position control? |
||
| } | ||
|
|
||
| public Command contract() { | ||
| return this.run(() -> io.setExtensionVoltage(-2)); | ||
| } | ||
|
|
||
| public Command stop() { | ||
| return this.run(() -> io.setExtensionVoltage(0)); | ||
| } | ||
|
|
||
| public Command runRollerSysid() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this as well |
||
| return Commands.sequence( | ||
| intakeRollerSysid.quasistatic(Direction.kForward), | ||
| intakeRollerSysid.quasistatic(Direction.kReverse), | ||
| intakeRollerSysid.dynamic(Direction.kForward), | ||
| intakeRollerSysid.dynamic(Direction.kReverse)); | ||
| } | ||
|
|
||
| public static TalonFXConfiguration getExtensionConfig() { | ||
| TalonFXConfiguration config = new TalonFXConfiguration(); | ||
| config.MotorOutput.NeutralMode = NeutralModeValue.Coast; | ||
| config.MotorOutput.Inverted = InvertedValue.Clockwise_Positive; | ||
|
|
||
| config.Feedback.SensorToMechanismRatio = GEAR_RATIO; | ||
|
|
||
| config.Slot0.kS = 0.24; | ||
| config.Slot0.kV = 0.6; | ||
| config.Slot0.kP = 110.0; | ||
| config.Slot0.kD = 0.0; | ||
|
|
||
| config.CurrentLimits.StatorCurrentLimit = 80.0; | ||
| config.CurrentLimits.StatorCurrentLimitEnable = true; | ||
| config.CurrentLimits.SupplyCurrentLimit = 60.0; | ||
| config.CurrentLimits.SupplyCurrentLimitEnable = true; | ||
|
|
||
| return config; | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file probably shouldn't be in this branch. To remove it, use |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| { | ||
| "fileName": "playingwithfusion2026.json", | ||
| "name": "PlayingWithFusion", | ||
| "version": "2026.1.16", | ||
| "uuid": "14b8ad04-24df-11ea-978f-2e728ce88125", | ||
| "frcYear": "2026", | ||
| "jsonUrl": "https://www.playingwithfusion.com/frc/playingwithfusion2026.json", | ||
| "mavenUrls": [ | ||
| "https://www.playingwithfusion.com/frc/maven/" | ||
| ], | ||
| "javaDependencies": [ | ||
| { | ||
| "groupId": "com.playingwithfusion.frc", | ||
| "artifactId": "PlayingWithFusion-java", | ||
| "version": "2026.1.16" | ||
| } | ||
| ], | ||
| "jniDependencies": [ | ||
| { | ||
| "groupId": "com.playingwithfusion.frc", | ||
| "artifactId": "PlayingWithFusion-driver", | ||
| "version": "2026.1.16", | ||
| "skipInvalidPlatforms": true, | ||
| "isJar": false, | ||
| "validPlatforms": [ | ||
| "windowsx86-64", | ||
| "linuxarm64", | ||
| "linuxx86-64", | ||
| "linuxathena", | ||
| "linuxarm32", | ||
| "osxuniversal" | ||
| ] | ||
| } | ||
| ], | ||
| "cppDependencies": [ | ||
| { | ||
| "groupId": "com.playingwithfusion.frc", | ||
| "artifactId": "PlayingWithFusion-cpp", | ||
| "version": "2026.1.16", | ||
| "libName": "PlayingWithFusion", | ||
| "headerClassifier": "headers", | ||
| "sharedLibrary": false, | ||
| "skipInvalidPlatforms": true, | ||
| "binaryPlatforms": [ | ||
| "windowsx86-64", | ||
| "linuxarm64", | ||
| "linuxx86-64", | ||
| "linuxathena", | ||
| "linuxarm32", | ||
| "osxuniversal" | ||
| ] | ||
| }, | ||
| { | ||
| "groupId": "com.playingwithfusion.frc", | ||
| "artifactId": "PlayingWithFusion-driver", | ||
| "version": "2026.1.16", | ||
| "libName": "PlayingWithFusionDriver", | ||
| "headerClassifier": "headers", | ||
| "sharedLibrary": true, | ||
| "skipInvalidPlatforms": true, | ||
| "binaryPlatforms": [ | ||
| "windowsx86-64", | ||
| "linuxarm64", | ||
| "linuxx86-64", | ||
| "linuxathena", | ||
| "linuxarm32", | ||
| "osxuniversal" | ||
| ] | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lintake also has rollers, so add a roller io as well