Getting Team color from the field REDUX

Two years ago it was recommended that the robot code get the alliance color every 1 second during competitions. That’s a pain to produce and maintain dynamic Commands that determine the color and act appropriately. It’s easier to create the proper commands once in robot container if that’s safely possible now. Is it still a problem that we must get the color periodically?

Now you should be able to check DriverStation.getAlliance() until the Optional<DriverStation.Alliance> that is returned has a value (checked with isPresent()). If there’s a value, you can save it and shouldn’t need to recheck

1 Like