Skip to content

Conversation

@blueskinlizard
Copy link

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.

@blueskinlizard
Copy link
Author

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(){
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, 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
Copy link
Member

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)

@mstatistics mstatistics linked an issue Sep 21, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actually call resetToAbsolute()

2 participants