-
Notifications
You must be signed in to change notification settings - Fork 0
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
Intake and indexer #19
Conversation
# Conflicts: # src/main/java/org/team1540/robot2024/Constants.java # src/main/java/org/team1540/robot2024/RobotContainer.java # src/main/java/org/team1540/robot2024/util/LoggedTunableNumber.java
src/main/java/org/team1540/robot2024/subsystems/indexer/Indexer.java
Outdated
Show resolved
Hide resolved
public Command feedToAmp() { | ||
return Commands.sequence( | ||
Commands.runOnce(() -> indexerIO.setFeederVelocity(-600), this), | ||
Commands.waitSeconds(5), |
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.
This could wait for X time after the note stops being seen (waitUntil
), just to make sure it gets out before stopping
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.
For sequences though I might make them their own classes
return Commands.sequence( | ||
Commands.runOnce(() -> indexerIO.setFeederVelocity(1200), this), | ||
Commands.waitSeconds(1), | ||
Commands.runOnce(() -> indexerIO.setFeederVelocity(0), this) |
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.
I might make this not just end after a second. This will only be used in other sequences anyway so maybe just having it return the command to set feeder velocity to 1200 would be good
public class IndexerIOSim implements IndexerIO { | ||
|
||
|
||
private final DCMotorSim intakeSim = new DCMotorSim(DCMotor.getNEO(1), INTAKE_GEAR_RATIO,0.025); |
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.
what is 0.025 doing here? (it should probably be in constants file)
public class IndexerIOSparkMax implements IndexerIO { | ||
private final CANSparkMax intakeMotor = new CANSparkMax(INTAKE_ID, CANSparkLowLevel.MotorType.kBrushless); | ||
private final CANSparkMax feederMotor = new CANSparkMax(FEEDER_ID, CANSparkLowLevel.MotorType.kBrushless); | ||
private final DigitalInput indexerBeamBreak = new DigitalInput(0); |
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.
constants file for digitalinput id
public double setpointRPM; | ||
public double feederPositionError; |
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 setpoint logging should happen in the subsystem, not the IO inputs. Also, why are you logging the position error? Isn't the feeder only velocity controlled?
public class Indexer extends SubsystemBase { | ||
private final IndexerIO indexerIO; | ||
private final IndexerIOInputsAutoLogged indexerInputs = new IndexerIOInputsAutoLogged(); | ||
private final boolean TUNING = true; |
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.
There's already a constant called tuningMode
in the constants file, use that instead of this
|
||
default void setFeederVelocity(double velocity) {} | ||
|
||
default void configurePID(double p, double i, double d) {} |
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.
This should probably be called configureFeederPID
since the intake isn't running a control loop
src/main/java/org/team1540/robot2024/subsystems/indexer/IndexerIOSparkMax.java
Show resolved
Hide resolved
private boolean isClosedLoop = true; | ||
private double intakeVoltage = 0.0; | ||
private double feederVoltage = 0.0; | ||
private double feederVelocityRPS = 0.0; |
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.
This should probably called feederSetpointRPS
, feederVelocityRPS
implies that this is the actual feeder velocity, which this is not.
No description provided.