Is there a way to identify the cRIO that Java is running on? Our robot code needs a little tweaking based on whether or not it’s running on the competition bot, the practice bot, or the mule board…
In Labview we could get a bundle that had the name, serial #, and mac address, as I recall. I see the kRioSerialNum constant in com.ni.rio.NiRioConstants, but have no idea what method I would feed it to…
I know I can lay a file down on the cRIOs to identify them (either just for this, or as part of a Preferences object), but prefer something that I don’t have to (remember to) redo after a cRIO format or reimage.
You can create a text file in the flash memory on the cRIO that says which robot it is. Then have the program open the file. An easier way might be to use the Preferences class and set it up once, then each time you start up check the preference settings.
This page shows how to use the Preferences with the Dashboard for setting the values which are stored on the robot. You can do that once for each robot then have your program read them at startup.
http://wpilib.screenstepslive.com/s/3120/m/7932/l/81114-setting-robot-preferences-from-smartdashboard
We used the preferences class with Java. I agree that it is preferable to not have to remember to set the preference, although the only time that has caused us a problem is when we ran a practice robot at an offseason competition and had to reimage to change the team number at the competition. We made sure the default was competition.
In LabVIEW, we used the cRIO IP address, but couldn’t figure out how to get that in Java.
yeah, this is finally rearing it’s ugly head. Looks like we’ll use the preferences object and assume it’s the competition bot if the preferences aren’t there, that way we just break the practice bot if we forget to set up the preferences after a reimage.
I’ll dig into the kRioSerialNum after bag day and “catch up on sleep” day…