-
Notifications
You must be signed in to change notification settings - Fork 0
First pass at climber subsystem #32
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
Conversation
spellingcat
left a comment
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.
🧗
| //not sure about these implementations, some issues with "static reference to non-static method" | ||
| public Command climbUp() { | ||
| return this.run( | ||
| () -> { | ||
| ClimberIO.setClimberPosition(MAX_ANGLE); | ||
| }); | ||
|
|
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.
so a static method/variable is a method/variable that is shared across all instances of an object. so for example if we have multiple rollerio objects but store a static variable in the rollerio class, all of those rollers would be able to access it. we denote a call to something static by using the class name instead of a local variable name, which is what you've done here by capitalizing Climber
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.
however, setClimberPosition isn't actually marked as a static method so it gets mad when it thinks you're trying to call something statically (by using the class name) when it isn't static
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.
better explanation here: https://www.baeldung.com/java-static (sections 1-3 and 6)
| ClimberIO climberIO; | ||
| ClimberIOInputsAutoLogged climberInputs = new ClimberIOInputsAutoLogged(); | ||
|
|
||
| public ClimberSubsystem() {} |
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.
you have 2 constructors
|
|
||
| //member variables here? | ||
|
|
||
| public ClimberSubsystem(ClimberIO climberIO) { |
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.
remember to create the climbersubsystem in Robot.java (L263)
src/main/java/frc/robot/Robot.java
Outdated
| intake = new LintakeSubsystem(); | ||
| shooter = new TurretSubsystem(); | ||
| climber = new ClimberSubsystem(); // TODO climber | ||
| climber = new ClimberSubsystem(); |
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.
make sure to pass a climber io into this constructor as well
|
|
||
| @AutoLog | ||
| public static class ClimberIOInputs { | ||
| public double climberPosition = 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.
| public double climberPosition = 0.0; | |
| public double motorPositionRotations = 0.0; |
you named it motorPositionRotations elsewhere
| private Notifier simNotifier = null; | ||
| private double lastSimTime = 0.0; | ||
|
|
||
| public HoodIOSim(CANBus canbus) { |
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 HoodIOSim(CANBus canbus) { | |
| public ClimberIOSim(CANBus canbus) { |
it gets mad at you when you try to create a class that doesn't match the file name
| return this.run( | ||
| () -> { | ||
| climberIO.setClimberPosition(MAX_EXTENSION_METERS); | ||
| wait(1000); |
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.
so waiting like this is a bit dangerous because it pauses all the code running in this thread (which is pretty much everything). i think what i'd do is just make extend and retract commands which set it to max position and min position respectively - we will handle figuring out which position it goes to and when through triggers elsewhere in the superstructure
|
also be sure to run a build sometime soon so the formatter runs |
src/main/java/frc/robot/Robot.java
Outdated
| // null (and we need it to be not null) | ||
| if (climber == null) | ||
| climber = new ClimberSubsystem(); // TODO new ClimberSubsystem(new ClimberIO() {}) and such | ||
| // climber = new EmptyClimberSubsystem(new ClimberIO(canivore) {}); |
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.
| // climber = new EmptyClimberSubsystem(new ClimberIO(canivore) {}); | |
| climber = new EmptyClimberSubsystem(canivore); |
| super(new ClimberIO(canbus)); | ||
| } | ||
|
|
||
| public Command climbUp() { |
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 Command climbUp() { | |
| @Override | |
| public Command extendClimber() { |
make sure this method has the same name as the method in ClimberSubsystem, and that there's the @OverRide annotation above it. this makes sure that when we call extendClimber on an EmptyClimberSubsystem, it does it the EmptyClimberSubsystem's way and not the default ClimberSubsystem's way
| return this.idle(); | ||
| } | ||
|
|
||
| public Command climbDown() { |
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 Command climbDown() { | |
| @Override | |
| public Command retractClimber() { |
src/main/java/frc/robot/Robot.java
Outdated
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.
add something here that binds it to a button - so like driver.x().onTrue(extend climber) and driver.y.onTrue(retract). this might change later but we can just do this for testing
|
i'll handle the merge for you |
No description provided.