KacperLa / GearBox

Project GearBox
0 stars 0 forks source link

[Imporvement] Adding parametrics to the script #1

Open madhephaestus opened 3 weeks ago

madhephaestus commented 3 weeks ago

The way to access the parametric database is documented here: https://gist.github.com/ca2cfbba52c848da45e7.git

KacperLa commented 3 weeks ago

@madhephaestus Just curious about the database usage. I saw this issue https://github.com/CommonWealthRobotics/BowlerStudio/issues/316 Is there a constructor for a LengthParameter that allows you to just pass in the name of the param? I guess I see the potential issue where the param might not exist in the data base so you need to fall back on something. In the current implementation it would be the value passed into the constructor.

I guess to make this clear maybe just add to the doc that a DB value always takes presence over default value passed to the constructor.

Am I understanding this right?

madhephaestus commented 3 weeks ago

yeah, thats the point, to make sure there is always a value returned, never null. If you want to set it explicitly, you can do so with the setMM() or setStrValue() methods

KacperLa commented 3 weeks ago

So, one more question. I noticed that if I edit the json directly, the value I fudged manually dosen't stick, is bowler caching the values somewhere?

madhephaestus commented 3 weeks ago

call CSGDatabase.setDbFile(CSGDatabase.getDbFile()) to re-load from file. Normal operation is to use the in-ram cache of the HashMap for speed, and saving to the file after changing values in code.