View Single Post
  #3   Spotlight this post!  
Unread 25-01-2014, 14:33
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 429
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: WPILib projects don't have standard Java classes?

If you are looking into using a properties file to avoid having to recompile/deploy every time you want to tweak a setting, I would suggest taking a look at 254's Constant implementation from 2013.

ConstantBase
Constants

It's a pretty straight forward implementation. Default values for all variables are stored in the Constants class. When an instance of this class is created (from robotInit() would be a good idea), it will go out and look for a file called Constants.txt. It will read in the key value pairs defined in the txt file. For each key/value pair in the file, it will search the list of known keys for a match. If it finds a matching key, it will overwrite the value specified.

Your Constants.txt file only needs to define values for keys you would like to override the default of.

I integrated the ConstantBase class into my team's code last night, haven't had a chance to deploy the code yet, but we will likely use this on our 2014 robot.
__________________
http://team2168.org
Reply With Quote