View Single Post
  #6   Spotlight this post!  
Unread 21-05-2010, 12:04
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: Learning Autonomous Mode?

We implemented a recording system for our robot this year. It is written in C++, as well as in Java. The main reason was to allow us after a match to review what happened out on the field. So we captured all user and senor data, and stored it in a text file. After implementing the recorder, we verified that it had minimal impact on the run time behavior of the robot. Each record contains a timestamp, and is written only when the user inputs change. There's plenty of flash disk space, so this was never a problem. But a match would have 1000's of records.

With the recorder in place, we then proceeded to write a replay function. The file can be read, and the data used to replace the users specified actions. For the first version of the code, we simply ignored the sensor data. This, as has been pointed out, leads to the robot not quite doing the exact same thing every time. Without sensors, you are using time as a means of controlling behavior. 3 seconds forward, 2 seconds back, etc. Since the mechanical system has quite a bit of variance, this isn't particularly accurate. This can be enhanced by using the captured sensor data. Say you have a gyro, and you record the gyro data. Then during replay you can compare the current gyro data to the recorded data, and if they aren't the same (within some epsilon), you adjust the movement of the robot to compensate for the drift.

Finally we then had our driver, do what we wanted for our autonomous mode. Pulled the file off the CRIO, cleaned it up a bit, and then saved it on the CRIO as autonomousXXX.txt. Then all our autonomous code did was read a switch that indicated what autonomous file to run, and opened the file and replayed it.

At the end of the day, there is a lot of uses for the record data, above and beyond just finding out what the robot thought it was doing out on the field.
Some that are on our todo list:
1) Macro actions, saved as files and replayed.
2) Creating a simulation so we could replay the files and see what happened during the match.

---Michael J Coss Lead programming mentor for team 303