Quote:
Originally Posted by Tom Line
We've made a concerted effort over the past three years to create code that doesn't need to be recompiled.
For instance, any constant (numeric) value that we use on the robot is actually stored in a text file and loaded at code startup.
Likewise, we use a scripting system that reads the commands from text files for autonomous.
In that way, changes to auton or constants are as quick as a change of a number in notepad, and then double clicking a batch file to dump it onto the cRIO. We can write entirely new and complicated autonomous programs in a minute or two.
|
We have also done the same thing, using a text file to store constants (we've added strings this year). LabVIEW has some built in Configuration File VI's that allow for a standard Windows config file format:
[Section]
Key = Value
These 'Preferences' are read before any other calls in Begin.vi. To aid in the development, we've added a multiple button press on the two driver joysticks to reload these values. This makes it a lot faster to change some constants and ftp them down to the cRIO and not have to reboot it.
Also, this year we have implemented a record and replay system for autonomous. From the custom dashboard we enter a file name and flip a toggle switch. The code on the cRIO opens a binary file and stores the needed values to it. We store the following every 10 ms:
left joystick Y
right joystick Y (we use tank drive),
start position of the catapult
stop position of the catapult
intake arm position (up / down)
intake roller speed (sign determines direction)
transmission state (high / low gear)
launch button
When the toggle switch is pressed again or a time limit has been reached the file is closed.
To replay this file, the driver selects it from a drop-down list on the custom dashboard (list is published from Begin.vi, which reads the root drive of the cRIO), this file name is passed back to the cRIO and opened. Every 10 ms the next set of values is read from the file and written to their original variables. All control of the robot is done in Periodic Tasks.vi.