Quote:
Originally Posted by Jared341
We do something very similar to the above (but in Java).
We defined a custom "scripting format" that lets you describe high level robot behaviors in a plain text format. The "autonomous mode text file" can be created on a laptop (either with Notepad or, hopefully next year, in a full-featured GUI) and FTP'd down to the cRIO. Upon autonomous mode starting, our system searches the file system for the autonomous.txt file and executes the commands sequentially.
The actual bit of code that executes each command (or Action, as we call them) is highly object oriented. An "AutonomousThread" instance receives an array of Action objects. Actions each have "execute()" and "cancel()" methods that are implemented to provide the desired robot behavior. Because of the beauty of polymorphism, you just need to loop through each Action and call "execute()" for each step of the recipe.
If you have the time (and interest), a system like this is fun to create and can lead to more maintainable code. Of course, it takes a lot of boilerplate to get it up and running, and you need to be absolutely sure it is bug free or you will be doing yourself no favors.
|
Well, excellent, I guess I don't have to mention that idea then.
I made a simple parser where you list out the commands and values for the commands in an cluster (aka struct).The datatype is
array[cluster[enum "action" (forward, strafe, turn, kick), dbl "value"]]
These are the actions (and order) that it executes.
This could be very easily expanded to read that array from a text file.
One modification that SHOULD be made is to send the action and action# back to the driver station.
As for chosing the section of the field, there is a function that tells you that in the WPI libraries (under Driver Station. I think it's called "get alliance", but it also get you your position, which is either set by FMS or your driver station).
However, I have a question:
Is anyone else here working in LabVIEW, or am I on my own for now?