Possible code?

  1. 6 weeks ago


    Dec 7 68357A
    Edited 6 weeks ago by James6555

    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?

  2. James6555

    Dec 7 68357A

    This is in robotc by the way

  3. James6555

    Dec 7 68357A

    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.

  4. Rick TYler

    Dec 7 Teachers/Coaches, Event Partner, V5 Beta Moderator Redmond, Washington Founder of Exothermic Robotics

    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.

  5. James6555

    Dec 7 68357A

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

  6. 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.

  7. James6555

    Dec 7 68357A

    thanks I'll look into it


or Sign Up to reply!