| AlexNeedsAName |
12-02-2017 12:27 |
TIL There's a builtin function for getting the alliance station from FMS
I found a function in the wpilib that tells you what alliance you're on! :D
Code:
import edu.wpi.first.wpilibj.hal.AllianceStationID;
import edu.wpi.first.wpilibj.hal.HAL;
AllianceStationID AlianceStation = HAL.getAllianceStation();
boolean redAlliance = false;
if(AlianceStation == AllianceStationID.Red1 || AlianceStation == AllianceStationID.Red2 || AlianceStation == AllianceStationID.Red3) redAlliance = true;
I figured this could be useful for some teams in auton since the field isn't symmetrical. I wish they would have made it more accessible, since FIRST doesn't even consider the HAL to be user facing.
|