Skip to content
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

Better rev up, better amp shot, more buttons for zach #134

Merged
merged 8 commits into from
May 3, 2024
Merged

Conversation

rflood07
Copy link
Collaborator

@rflood07 rflood07 commented May 2, 2024

No description provided.

if (speed < targetSpeed + revUpEn){
double difference = targetSpeed - speed;
SmartDashboard.putNumber("SHOOTER/desired speed difference", difference);
if (difference>revUpEn){
revState = 1;
Copy link
Contributor

@EchoNotation EchoNotation May 2, 2024

Choose a reason for hiding this comment

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

Having this revstate variable be an integer is acceptable here-- especially since there is an obvious connection between the sign of revstate and the motor behavior. However, whenever you're implementing some logic that should only take certain states, it's a good idea to use an enum. https://www.w3schools.com/java/java_enums.asp Using an enum could improve readability (e.g. revState = RevState.REVVING_UP or revState = RevState.IDLE), but more importantly can prevent bugs like accidently setting revState to 2.

@rflood07 rflood07 merged commit b4b4d98 into main May 3, 2024
1 check passed
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.

3 participants