Autonomous Recorder

I am not a very good programmer so for the upcoming season, I wanted to try and shortcut autonomous. I wanted to try and make an “autonomous recorder” so you could control the robot for 15 seconds and simulate an auto routine, and then through recording something like voltage or encoder ticks during this time play it back as an autonomous program. I’m pretty sure this has been done before, but again since I’m a bad programmer I’m not sure how to go about accomplishing this. Any help is appreciated! Lectures too!

1 Like

We created a program that describes this; recording driving and playing back as autonomus, we called it capture replay. I noticed your language is Java so this might not be exactly what you’re looking for since our code is in C++. 3229’s Auto code

2 Likes

a good way to go about this would be to record the setpoints of your motor controllers with timestamps and then to “play them back” using a pid loop. this way, your path will be consistent no matter what the voltage of the battery is / other random things that can affect the path. recording and playing back purely the controller input or something similar can be dicey as it doesn’t ensure repeatability given slightly differing conditions.

depending on what motor controllers you are using, you may be able to run the pid loops on them internally. this means you only really have to write the code to order / record the setpoints.

hope this helps.

2 Likes

Thank you. Currently we are using SparkMAX’s for all our motors. My only question is what you mean when you say “play them back using a PId loop”. Do you mean use the values as setpoints for the PId or something else? Thank you again!

the setpoint is the desired location of the mechanism in question. in this instance, it’s the encoder reading of each side of your drivetrain, which change as you go along your desired path. you want to record these, and then run your pid loop so that it tries to hit those values. make sure you are recording the actual encoder values, and not some other arbitrary thing such as voltage / controller input. that way the loop has a “ground truth” of the path it’s trying to follow. does this make sense?

1 Like

So if you are making a pid loop out of this, you would implement the recorded setpoints as your error and somehow keep track of this in your report error method against the current time. Then your use output method wouldn’t have the setpoint. Sorry, not sure how this would work. Can you go into some more detail?

Oh OK, thank you for the clarification, it was really helpful!

Yes, thank you.