Closed natejank closed 2 years ago
yes
this was just to fix an issue during drive practice where the color sensor reported zero and crashed the entire robot
it seemed like the most direct solution
I decided the easiest solution would just be to catch the exception in getAlliance to return Invalid
directly instead of relying on side effects. The only potential downside do doing it this way is that ArithmeticException
s are unchecked, so if we decide to call normRaw anywhere else, we'd have to also catch there and the method doesn't have any indication that it actually throws something (I'm not sure why we'd be calling it).
The other option would be to define an InvalidStateException to throw after getting a DivByZero to make sure we always catch, but I didn't think that would be necessary.
Have the color sensor code changes been tested on the robot?