![]() |
Programmatically Determine Which Rio Code is on
Is there a way to determine in java which roboRio the code is runing on? We have several RR and want to run the same code on all of them with some differences determined at run time in the robot class constructor or init method. The robots carrying the RRs are very similar but not exactly the same.
|
Re: Programmatically Determine Which Rio Code is on
Our solution to the close-but-not-identical-robot problem many years ago was to put a jumper on one of the DIO ports. One robot read the input as "true", the other read "false". I think the code picked a different set of PID constants and sensor calibration points for each robot.
If you have several robots, you can use multiple Digital Inputs. Or you might use a simple resistor divider circuit on an Analog Input, with each robot having a unique "ID voltage". |
Re: Programmatically Determine Which Rio Code is on
Im sure there is probably some flag you could set that could then be read natively in your code, but something really simple might just be to put a text file on each roborio, each containing a unique identifier, like "Practice Setup" or "Competition Robot". Simply read this file in your robot code and you'll have which rio its running on.
|
Re: Programmatically Determine Which Rio Code is on
Quote:
|
Re: Programmatically Determine Which Rio Code is on
We've done this with a 'name' field in a WPILIB Preferences object, we've done it with a jumper on the bot (like Alan), and we have worked off the network MAC address.
In our experience, Alan's is the best/easiest way if you have the spare DIO (you don't need a programmer around if you move roboRIO XXXX from the test chassis to the competition chassis). We made sure the competition robot required NO jumpers, we used jumpers to disable stuff on the test/practice robots. Murphy says you will lose the jumper if you need it at competition. If you want to go from the MAC address (yes, there is a typo in one of the MACs): Code:
public boolean havePneumatics = false; |
Re: Programmatically Determine Which Rio Code is on
Thanks for the replies, all good suggestions. I was trolling for an API that would return a serial number or some such built in identifier and the mac address would fill that bill. However, I am leaning toward the configuration file using a java properties object. That would offer the most flexibility and future expansion.
|
Re: Programmatically Determine Which Rio Code is on
as I recall, the serial number is accessible from LV, but it didn't get exposed to the Java or C++ APIs.
|
| All times are GMT -5. The time now is 07:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi