how to identify roboRIO

We have a need to determine the unique roboRIO our code is running on; our test robot does not have a PCM, so we don’t want to enable pneumatics if it’s running on the test box so we don’t flood the console with the CAN timeout errors?

Has anyone hit on a good way to determine the identity of the roboRIO (serial #, or name?)

We’re working off the MAC addresses of the network interfaces right now, which is fine, but was curious if anyone had done it a different way.

I think I would put a switch on a digital input, or just a pigtail of wire that connects the input to ground. If it reads a false, then its execute code accordingly.

That’s a better idea than our thought of going off the roboRIO id. Doing it your way, if we have to swap roboRIOs, then we don’t need to touch code, just make sure the “I am a test chassis” jumper is NOT in place. When I read this, I first thought of putting a “I am the competition chassis” jumper in place, but if the jumper got lost, then we’d lose time making up one at a competition, so “I am a test chassis” it is. I suspect we’ll have enough DIO to get us by…

My curiousity is piqued, though, so if anyone has a way to do it, I’m interested. I remember that it was possible to pull the serial number from LabVIEW. I suspect they never put the appropriate ‘hook’ into wpilibj to expose that functionality, though I suspect a clever person with the right documentation could pull it off using HALUtil and friends…

You can use the team number to differentiate. http://wpilib.screenstepslive.com/s/4485/m/13809/l/292213-c-java-porting-guide-2014-to-2015#TeamNumber

You could also just use the Preferences class with an enablePcm boolean variable.

Joe, Thomas, thanks…