
09-05-2013, 08:14
|
 |
 |
Flywheel Police
AKA: Matthew Lythgoe
 FRC #2363 (Triple Helix)
Team Role: Mentor
|
|
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,722
|
|
|
Re: Record Robot Actions
Quote:
Originally Posted by Greg McKaskle
The first attached image shows one way to record all data from one joystick every 20ms until the Done button is pressed. It then optionally saves it to a file. This code would fit well into periodic tasks.
The second image shows how to read all of the data from file and play it back at the same rate.
You probably don't need all six axes of the joystick, and you may want to record more than one. If that is the case, modify the data that goes into the cluster.
If you want to record the motor values and solenoid/relay values instead, that is an easy alternative and can be output from the Drive Robot function, accumulated, and logged.
If you decide to store sensor values and add control loops to the playback, that is indeed harder, and I'd recommend instead that you put that code into Drive Robot and store the set points.
If you are worried about memory usage, you most likely don't need more than 50 elements per second for no more than 15 seconds, or 750 elements in the array. The full joystick data is 50 bytes per element. Even if you store lots more values, for 1KByte per record, you still haven't used a megabyte, so you shouldn't have any memory issues. If you want to optimize for memory, you can move the file I/O inside the loop to avoid the largish array, scale the values from doubles to smaller values, use timestamps to compress the data, or do all sorts of other fun things.
As for switching to a different language, or practicing the language your team used this year, the off season is a great time to do it. I don't know of anything in command based programming that would make this any easier. Personally, I'd encourage you to become familiar with several of the languages as they each have unique features and values.
Greg McKaskle
|
I agree completely Greg. No one language is better than another, and it is a great tool to have knowledge of several different languages.
|