-
Notifications
You must be signed in to change notification settings - Fork 3
Actually call resetToAbsolute() #9
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?
Conversation
|
I accidentally deleted the modules in Drive within the first commit😭 so that's why there are two commits. |
| return inputs.driveVelocityRadPerSec; | ||
| } | ||
| // Gets moduleio instance | ||
| public ModuleIO getModuleIO(){ |
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.
It is not good practice to allow direct access to the IO interface from elsewhere. Instead, could you make a function that calls the function in the io interface?
| public double getFFCharacterizationVelocity() { | ||
| return inputs.driveVelocityRadPerSec; | ||
| } | ||
| // Gets moduleio instance |
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.
| // Gets moduleio instance | |
| /// Gets moduleio instance |
In general, It would be better to use 3 slashes in comments above functions because that makes the comment interpreted as a javadoc, meaning it will appear when you hover over the function
| for(Module module : modules) { | ||
| module.getModuleIO().resetToAbsolute(); | ||
| } | ||
| }, 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.
| }, this); | |
| }, this).ignoringDisable(true); |
This function needs to ignore disabling
| drive.setPose( | ||
| new Pose2d(drive.getPose().getTranslation(), new Rotation2d())), | ||
| drive) | ||
| .andThen(drive.resetModulesToAbsolute()) // Resets modules when button pressed |
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 .andThen should be below .ignoringDisable because the .ignoringDisable needs to apply to the runOnce command, I don't think it does anything after you already make the command group (.andThen)
Within Drive.java I created a function that takes the modules array, gets the moduleIO instance from each element (getter function in Module.java), and runs resetToAbsolute() on them.
I didn't really know what it was meant by "reset gyro button" so I just called the Drive function I made sequentially when the y button was pressed.