How to determine which alliance you are on?

Will there be a way that the autonomous mode software can use some information from the tournament control system to determine which alliance a robot is on? In other words how can we find out which target our camera should track without a downloading a new program at the start of each game?

Thanks

I too am interested in the answer to this question. It would eliminate the possibility of flipping the autonomous mode switch the wrong way…

You will get a match schedule that will list which alliance color you are on for each match. That’s how you will know.

The typical way that this is done is through a switch mounted on your robot, which you set based on the alliance that you are on during that match. Your autonomous program then reads in the value of that switch at the start, and determines what camera code to load (or whatever it is that you’re doing.)

I am however, interested in finding out if there is a way to get the alliance information from packets available to users from the field. I know this would take a lot of thought and picking through information, but I wonder if it’s possible.

But the short answer is to simply use a switch.

Jacob

Take a look at DriverStation::GetAlliance.

From DriverStation.cpp:

DriverStation::Alliance DriverStation::GetAlliance()
{
	if (m_controlData->dsID_Alliance == 'R') return kRed;
	if (m_controlData->dsID_Alliance == 'B') return kBlue;
	wpi_assert(false);
	return kInvalid;
}

If you look in NetworkCommunication/FRCComm.h, it seems that both alliance and position information is available in the control data packets.


struct FRCControlData{
...
	char dsID_Alliance;
	char dsID_Position;
...
};

Assuming this works properly, you should be able to use this on the field to determine your alliance color without a physical switch.

There is a simmilar vi in the pending update . It gives alliance color and team position ( which I assume means the driver position)

Thanks
The C++ code is the type of information I am looking for.
Can I get to similar data within Labview?

I just installed Update 3 and I see there is now WPI Robotics Library > DriverStation > GetAlliance.vi.

GetAlliance.png


GetAlliance.png

We are using USER1 switch on the cRIO to switch the alliance. See the picture for an example

http://www.rsisk.com/user1sw.jpg

Nice! Thanks for the info.

Thanks for the help
I am downloading update #3 and will try the Get Alliance vi on Thursday.

With the new vi you should be able to just replace the “Friend colors” enum with case structure and the “Get Alliance” vi. For testing, just use a switch on the console.
Below is the mod we will try.





Just something I noticed is that a switch is still helpful if you have several different types of autonomous programming depending on how you want to work with your alliance. I know that at Tempest N’ Tampa, it would have been a mess if we and Pink only had a start position in the middle. But thankfully, Pink had 7 different autonnomous modes while we had 4. They were all lot more diverse in their modes, but we try.