View Single Post
  #1   Spotlight this post!  
Unread 12-02-2017, 12:27
AlexNeedsAName's Avatar
AlexNeedsAName AlexNeedsAName is offline
Registered User
AKA: Alexander
FRC #3641 (The Flying Toasters)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2015
Location: South Lyon, MI
Posts: 13
AlexNeedsAName is an unknown quantity at this point
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!

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.
Reply With Quote