-
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
Shooter #2
base: main
Are you sure you want to change the base?
Conversation
@@ -103,6 +107,8 @@ private void configureBindings() { | |||
autonomous().whileTrue(new ProxyCommand(autos::get)); | |||
FaultLogger.onFailing(f -> Commands.print(f.toString())); | |||
|
|||
teleop().onTrue(shooter.shoot()); |
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.
Likely left here for testing purposes, but noting this should be changed / removed soon!
|
||
public void setVoltage(double voltage); | ||
|
||
public double getVelocityRad(); |
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.
We typically avoid mentioning the unit return type in our code b/c it's unnecessary (we default to SI units anyway. Any different units should be noted in a comment (ask your mentors)
public static final double kv = 1; | ||
public static final double ka = 1; | ||
|
||
public static final double gearing = 1; |
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.
public static final
constants (except k__ constants) should be named in SCREAMING_SNAKE_CASE
} | ||
|
||
/** | ||
* creates Shooter depending on if it's real or not. |
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.
All documentation should be properly capitalized and grammafied and english positive, or something
* wheel. | ||
*/ | ||
public static Shooter create() { | ||
return Robot.isReal() ? new Shooter(new RealWheel(true, TOP_WHEEL), new RealWheel(false, BOTTOM_WHEEL)) : new Shooter(new SimWheel(), new SimWheel()); |
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.
apply spotless, ./gradlew sA
in terminal to beautify this
pidTop.calculate(top.getVelocityRad(), target) + ffTop.calculate(target, (target-prevTop)/Constants.PERIOD.in(Seconds))); | ||
} | ||
|
||
private void setBottomSpeed(double target) { |
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.
Is there a case in which having these speeds be different is valuable? The code duplication is undesirable & the ability to make mistakes with flywheels spinning in opposite directions while compressing a note through them is very high
pidBottom.calculate(bottom.getVelocityRad(), target) + ffBottom.calculate(target, (target-prevBottom)/Constants.PERIOD.in(Seconds))); | ||
} | ||
|
||
private void setSpeed(double topTarget, double topBottom) { |
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.
topBottom
??
|
||
public void setVoltage(double voltage) { | ||
sim.setInputVoltage(voltage); | ||
sim.update(PERIOD.in(Units.Seconds)); |
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 units library is already statically imported so you can just have Seconds
there without the dot notation
|
||
/** SimWheel */ | ||
public class SimWheel implements WheelIO { | ||
@Log.NT FlywheelSim sim; |
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.
Monologue won't ever send this over NT (it's not Sendable
to begin with).
Instead, stick to placing this annotation over the subsystem getters to retrieve important information for logging in ALL of your hardware implementations, not just in your sim or real impls (you already do this so good work)
motor.setInverted(inverted); | ||
motor.setSmartCurrentLimit(30); | ||
motor.burnFlash(); | ||
encoder = motor.getEncoder(); |
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.
Set encoder conversion somewhere for replacement when you get values
Created a shooter subsystem.