View Single Post
  #7   Spotlight this post!  
Unread 08-05-2013, 22:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Record Robot Actions

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
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	39
Size:	122.4 KB
ID:	14798  Click image for larger version

Name:	Clipboard 2.png
Views:	37
Size:	50.0 KB
ID:	14799  
Reply With Quote