View Single Post
  #35   Spotlight this post!  
Unread 16-05-2015, 15:27
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: Best Sensor for Unlimited Rotation Swerve

Quote:
Originally Posted by RyanShoff View Post
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.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2