Just the sight of you makes my vision system go haywire.
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2   Spotlight this post!  
Unread 12-02-2017, 12:43
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,109
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: TIL There's a builtin function for getting the alliance station from FMS

Quote:
Originally Posted by AlexNeedsAName View Post
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.
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.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-02-2017, 14:53
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
Re: TIL There's a builtin function for getting the alliance station from FMS

Ok, thanks. I didn't realize that.
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2017, 14:57
CalTran's Avatar
CalTran CalTran is online now
MST Rolla Senior
FRC #2410 (BV CAPS Metal Mustang Robotics)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: Overland Park, Kansas
Posts: 2,454
CalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond reputeCalTran has a reputation beyond repute
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.
__________________
Team 2410 thinks KISSing is amazing! Keep It Super Safe!
  • "You know you've been in robotics too long when you start talking to your tools." "Well, you've been in robotics CLEARLY too long when they start talking back"
  • Theory is when you know everything but nothing works. Practice is when everything works but you don't know why. On our team, theory and practice comes together - nothing works and nobody knows why.
MMR 2410 Student (2010 - 2013) | MMR 2410 Mentor (2013 - Present)
FTC Game Announcer / EmCee (2014 - Present) | FRC EmCee (2015 - Present) | FRC Referee (2016) | FTC Referee (2017)
Academic Student (Forever)
Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2017, 15:13
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 420
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: TIL There's a builtin function for getting the alliance station from FMS

Quote:
Originally Posted by CalTran View Post
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
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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