Possible code?

Hi I was wondering if it was possible to use the data logs to control a robot manually and record the motor values and copy them autonomously, so it would do the same thing. If so how could you do it?

This is in robotc by the way

I just thought that maybe you could just record the motor values in a list. and then send those values in a while loop. But I don’t know how to do lists for robotc, if someone could help me with that that would be great.

People have done this over the years, but I think it’s safe to say that the code is not really very good. The best way to write an autonomous program is to write an autonomous program.

Yes I do realize that, we were planing to use pid for autonomous, this is just a side project I wanted to try.

If it’s a for-fun project, then have at it! Look at it as writing two separate programs: a recorder and a playback program. I would shy away from trying to make them the same program for the Cortex, as if you try to record too long of a program to its memory you might exceed its capability. I would have it do its recording via printf to console, by building a two-dimensional array. One index is time slices, and the other index corresponds to different joystick values at those time slices. You can write your printf statements such that the console output is one long formatted array that you can then copy-paste into the playback program. Something like


printf(",%d,%d]", AXIS1VALUE, AXIS2VALUE)

per time slice. The playback program could be the same driver program, but instead of writing values at set time intervals it pulls the next set of values out from its pre-programmed array of values. The other upside to this is you can save the recording for later, or save multiple recordings in different files.

thanks I’ll look into it