Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   TIL There's a builtin function for getting the alliance station from FMS (http://www.chiefdelphi.com/forums/showthread.php?t=155167)

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.

Thad House 12-02-2017 12:43

Re: TIL There's a builtin function for getting the alliance station from FMS
 
Quote:

Originally Posted by AlexNeedsAName (Post 1643719)
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.

There are functions in the DriverStation class that wrap those functions. There is getAlliance and getStation that get the same information without needing the HAL.

AlexNeedsAName 12-02-2017 14:53

Re: TIL There's a builtin function for getting the alliance station from FMS
 
Ok, thanks. I didn't realize that.

CalTran 12-02-2017 14:57

Re: TIL There's a builtin function for getting the alliance station from FMS
 
Teams have used it before to control their underglow. But auto programming is a good use for it too.

euhlmann 12-02-2017 15:13

Re: TIL There's a builtin function for getting the alliance station from FMS
 
Quote:

Originally Posted by CalTran (Post 1643778)
Teams have used it before to control their underglow. But auto programming is a good use for it too.

More than a "good use" considering the field isn't rotationally symmetric this year


All times are GMT -5. The time now is 15:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi