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.
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.
| // 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.
| }, 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.
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.