Quote:
Originally Posted by RyanShoff
I agree hard coding calibration values is bad.
We put a button on the smart dashboard called 'zero encoders'. Pushing it stores the steering encoder positions to the roborio using Preferences. That way there is nothing hardcoded, and the same code will work on two different robots. If something mechanically changes on the bot, just set the wheels to straight, press the button, and the new offsets are stored.
|
I like this approach. If you have to zero something, having the ability to set the values in code without having to redownload code is always nice.
Even so, it isn't that bad to have magic numbers in the code if you code in such a way that the magic numbers are easily modified.
One approach is possible with the current FIRST control system is to keep these magic values in a text file on the PC, the have bit of code on the PC that communicates to the code running on the robot that sends the magic values to the robot upon request (RoboRIO sends a UDP message "please send me MagicNoXXX" Code on PC opens text file, finds MagicNoXXX, replies with UDP message "MagicNoXXX=1234"). It even works in combination with the button idea as well. Humans put robot into known location, hits RememberTheseMagicNumbers Button on the robot, RoboRIO sends UDP message "MagicNo001=1000, MagicNo002=2000, ...", Code on PC then openes text file and updates or adds the values to the list and replies to RobioRIO via UDP "as you wish")
Seems like a system that could work. (note to
PaulT what do you think, should we do this? Seems like our "play sound X code" could do this as a side business without breaking sweat)
Dr. Joe J.