-
Notifications
You must be signed in to change notification settings - Fork 3
IO Layers optimized #43
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?
Changes from all commits
36bdd24
171a8e1
f3b899a
4b78c6d
0bc30b6
4b5d565
a32e314
75c9221
9f16ce3
8e1e18a
eda686f
faae9b8
4313ac7
59fe355
ef7a6e5
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 |
|---|---|---|
|
|
@@ -17,4 +17,4 @@ | |
| // private Autos() { | ||
| // throw new UnsupportedOperationException("This is a utility class!"); | ||
| // } | ||
| // } | ||
| // } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,36 +4,22 @@ | |
|
|
||
| package frc.robot.subsystems.AlgaeRoller; | ||
|
|
||
| import com.revrobotics.RelativeEncoder; | ||
| import com.revrobotics.spark.SparkBase.PersistMode; | ||
| import com.revrobotics.spark.SparkBase.ResetMode; | ||
| import com.revrobotics.spark.SparkLowLevel.MotorType; | ||
| import com.revrobotics.spark.SparkMax; | ||
| import com.revrobotics.spark.config.SparkBaseConfig.IdleMode; | ||
| import com.revrobotics.spark.config.SparkMaxConfig; | ||
| import com.revrobotics.spark.SparkMax; | ||
| import frc.robot.Constants; | ||
|
|
||
| public class AlgaeRollerIOPB implements AlgaeRollerIO { | ||
| private final SparkMax motor = | ||
| new SparkMax(Constants.PracticeBotConstants.ALGAE_ROLLER, MotorType.kBrushless); | ||
| private final SparkMaxConfig config = new SparkMaxConfig(); | ||
| private final RelativeEncoder encoder = motor.getEncoder(); | ||
| public class AlgaeRollerIOPB extends AlgaeRollerIOCB { | ||
|
|
||
| /** Creates a new AlgaeIntakeRollerIOPB. */ | ||
| public AlgaeRollerIOPB() { | ||
|
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. You'll need to include the super(); keyword
Contributor
Author
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. How do I implement the keyword? Do I use it after extends and then state the class a second time (with IOCB layer)? |
||
| super(); | ||
| motor = new SparkMax(Constants.PracticeBotConstants.ALGAE_ROLLER, MotorType.kBrushless); | ||
|
|
||
| config.inverted(true); | ||
| config.idleMode(IdleMode.kBrake); | ||
| motor.configure(config, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); | ||
| } | ||
|
|
||
| public void setDutyCycle(double dutyCycle) { | ||
| motor.set(dutyCycle); | ||
| } | ||
|
|
||
| public void updateInputs(AlgaeRollerIOInputs inputs) { | ||
| inputs.rollerDutyCycle = motor.get(); | ||
| inputs.rollerPosition = encoder.getPosition(); | ||
| inputs.rollerVelocity = encoder.getVelocity(); | ||
| inputs.rollerCurrent = motor.getAppliedOutput(); | ||
| } | ||
| } | ||
| } | ||
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.
Needs to call super(); in the constructor
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.
If the config code below is identical to the config code in the super class, delete this