Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Team Color Identification (http://www.chiefdelphi.com/forums/showthread.php?t=73323)

legotech25 31-01-2009 13:12

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.

Shinigami2057 31-01-2009 13:18

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


DtD 31-01-2009 14:33

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

~DtD

wt200999 31-01-2009 16:13

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 ;)

byteit101 31-01-2009 22:35

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


All times are GMT -5. The time now is 02:39.

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