Go to Post heh...do the math! - MrForbes [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 01-31-2009, 01:12 PM
legotech25's Avatar
legotech25 legotech25 is offline
Sarah
AKA: Sarah
FRC #1714 (TMCRC)
Team Role: Leadership
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Wisconsin
Posts: 56
legotech25 will become famous soon enoughlegotech25 will become famous soon enough
Send a message via AIM to legotech25 Send a message via Yahoo to legotech25
Team Color Identification

Hello all,

As far as I understand, we should receive an indicator of what team we're on from the competition port on the Driver's Station. Does anyone know how to access this in our programming code or if this is even possible? (we're using c++)

Thanks,
Sarah

Edit: I found it, but I will leave this posted as a refference for other teams. The Driver Station class contains an enumerated variable called "Alliance" with the values kRed, kBlue, and kInvalid.
__________________
Team Captain - More Robotics 1714

2009 Milwaukee - Chairman's Award
2008 Milwaukee - Chariman's Award
2007 Cleveland - Kliener Perkens Buyers Caufield Entrepenureship, Engineering Insparation
2007 Milwaukee - Kliener Perkens Buyers Caufield Entrepeneurship, Website, Motorola Quality Underwriters Laboratory Safety
2006 Atlanta - Rookie Inspiration
2006 Cleveland - Rookie All-Star, Safety Runner-up
2006 Milwaukee - Rookie All-Star, Safety Runner-up

pi = 3.141592653589793238462643383279502884197169399715 10 ^_^

Last edited by legotech25 : 01-31-2009 at 01:19 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-31-2009, 01:18 PM
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Team Color Identification

You can get your team color by using the DriverStation class:

Code:
DriverStation ds;

if(ds.GetAlliance() == DriverStation::kRed)
  // do something
else if(ds.GetAlliance() == DriverStation::kBlue)
  // do something else
else
  // WPI lib is broken as usual
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-31-2009, 02:33 PM
DtD's Avatar
DtD DtD is offline
I hope the watchdog starves!
AKA: Pathogen David
FRC #2410 (The Metal Mustangs (Merged from 2334, Hazmat Robotics))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Kansas
Posts: 86
DtD will become famous soon enoughDtD will become famous soon enough
Re: Team Color Identification

Anyone know a way to trick the robot into thinking it is on red or blue for testing purposes?

~DtD
Reply With Quote
  #4   Spotlight this post!  
Unread 01-31-2009, 04:13 PM
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 321
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Team Color Identification

I wouldn't play with the competition port at all, I would just say use a switch, and see if receiving it from the DS actually works at competition
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
Reply With Quote
  #5   Spotlight this post!  
Unread 01-31-2009, 10:35 PM
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Team Color Identification

if you know about classes, create a simple class
(this probably has bugs in it, but illustrates the point)
Code:
class FakeDriverStation :private DriverStation
{
Alliance GetAlliance(){return DriverStation::kRed;}
};

//Code 
//more code
//DriverStation DS;//make sure to uncomment this 
FakeDriverStation DS;//and comment this before competition
switch(DS.GetAlliance())
{
...
as an example
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does the Trackball Color Match your team Color??? ZInventor Kit & Additional Hardware 14 03-07-2008 08:09 PM
Team Identification on Robot 1337pcgamer Rules/Strategy 1 01-27-2006 05:59 PM
Determining Team Color larwilliams Programming 4 03-30-2005 07:41 AM
Team Color DrWorm Control System 1 02-02-2004 07:02 PM
Team Color LED's Phil_Lutz Technical Discussion 4 01-18-2004 07:56 PM


All times are GMT -5. The time now is 09:14 AM.

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