AusTINCANsProgrammingTeam / 2022RobotCode

Other
6 stars 2 forks source link

aim mode in ShooterSubsystem #11

Closed caseyjbrotherton closed 2 years ago

caseyjbrotherton commented 2 years ago

Using enum's in ShooterSubsystem for aimMode would allow for an easier to understand abstraction. https://github.com/AusTINCANsProgrammingTeam/2022RobotCode/blob/d5579f37169a2eb71b6de95731a66fed51a0eca2/src/main/java/frc/robot/subsystems/ShooterSubsystem.java#L13

Reference: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html

If you have an enum for the aimMode, then you can use symbols instead of numbers in other code places.

Also of note, you can calculate the length of the enum instead of using a number. Some thoughts here:

https://stackoverflow.com/questions/1741708/enum-values-length-vs-private-field

caseyjbrotherton commented 2 years ago

Here might be an even cleaner way to handle increments of enums:

https://stackoverflow.com/questions/17664445/is-there-an-increment-operator-for-java-enum