[Tutorial] How to Code a VEX Autonomous in Less than 5 Minutes

Many people always have issues with getting autonomous to work in time for a tourney. That is why I made a tutorial about how to code a semi-reliable auton very quickly.

This uses rerun code, also known as copycat code.

Basically, the robot records what it just did in driver control, then you can copy that output into the autonomous function, and the bot will run the whole thing again.

The video is also on my YT page here


Very nice tutorial and clever way of doing reruns with minimal main code!

However, doing autonomous reruns based on the time delays puts the limit on the number of steps and complexity of the run that you can do before errors start growing too large.

I will be looking forward for the next version of your rerun algorithm, where you will start using feedback from the encoders and other sensors.

Also, it may be relatively easy to reduce the amount of auto-generated steps by avoiding duplicate commands that don’t change between steps and/or switching to data arrays.

Despite that, still impressive solution based on how simple it would be to understand and implement for students who are just beginning to learn autonomous programming.


But you know, 1000 lines per second of movement

1 Like

I would caution teams to read carefully the RECF Student Centered policy:

Read carefully the programming section. Using this type of package in competition is probably a good indicator you are not ready to program autonomous, and unlikely to be able to explain how this package works when asked by Tournament Officials.


That would differ from using okapi or something like it how? You’re just giving it inputs and the code creates itself.

Also, I’m not an adult here, I’m their opponent. The policy does not adress getting help from a competitor on a different team.


The very essence of VRC is that teams are expected to design, build and program their own robots. If a team uses another’s teams programs/libraries, they are expected to be able to explain how it works and why they chose it.

Right now we see too much copy and paste with no learning. Why enable more of this? How are you really helping a team in the long run? Don’t get me wrong, I think it is terrific that you provide a tutorial, but the essence was “you aren’t ready to compete, so here take my short cut…”

I contrast that to my advice to teams in another thread on what steps they can take to have more consistent autonomous routines without a snippet of code.

I look forward to seeing other tutorials from you, it was well done.


First off. I appreciate the compliment

Secondly, do you also not support methods like Okapi motion profiling and Chassislib that many elite teams use? As I said above it’s also just inputting data to get a desired result. No real programming needed.


I’m planning to eliminate this issue entirely by putting each routine in it’s own file and just forgetting about it. K.I.S.S.

1 Like

The elite teams write their own code :slight_smile:

but that said, libraries if you understand how and why you are using probably ok. But we see lots of copy and paste, no citation as to the origins of the code, nor the ability to say how to tune a PID or why… etc you get the idea, the team is taking a short cut and not really owning their solution.

This particular case is an egregious case of team wanting to benefit from autonomous but not taking time and effort to code their own. It is not programming by the team.


That being said, by your own logic, if a team understands how this code works, shouldn’t they be able to use it just like anything else? It’s just 10 lines to create the recording. Can’t be too hard to learn how it works.


Also, for the record, we are using PID control for our auton, not this silly little challenge.


Taran didn’t dump the code online right? He also explains the code so the students can learn from it so if a team does try to imitate the code then they know how it works and they made it themselves. I feel like there is a double standard with programming compared to building. If you hole count a china bot then no one cares, but if you remake someone’s code reveal then you’re a filthy ctrl^c ctrl ^v kid. I understand the concern about actually learning, but this is how many people will learn.


Well, I mean, the code is on github, but you can’t do anything with it unless you understand how to do it yourself. My bot’s rerun code won’t work for any others without serious changes.


I do not fault the teams that share ideas. I do have issues with the teams that just take a short cut and have not learnt anything about development process. You want them to be good, I think there are better approaches.


I agree, but this also applies to robot design, and we’ve seen the uh… variety… of designs this year (and other years, notably itz and ss)

edit: point being people do learn things when they design robots like this (as lame as it is), and this is similar to the ‘shortcutting’ in programming


Question for Pascal: If I were to document and post code of (here on VF) some vision sensor auto-targeting I did over the summer, would that be bad? I wouldn’t be explaining how-to, just showing what it does and what the code does.

1 Like

That would be excellent to have and a great contribution. Just remind teams that adopt it to give credit where credit is due.

Also, if you did a tutorial on your development process would help teams to get better. We all have seen the early season scramble to get something working and teams improve during the season, but there a some who do not make such improvements because they do not have development process or have difficulty understanding why things work (or not).

Most of my development process is that I see someone mention something cool-sounding on discord, I spend a few days letting my brain figure it out in the background (kinda hard to explain that one) then I spend an hour trying it out. If it works I put it on YouTube. If not, I don’t.


I’d agree several Libraries allow teams to achieve advanced behavior/abilities without knowing anything about how they work. Like @TaranMayer states, for the most part students only have to know the function name and change a couple values.

The method shown in this post has a lower ceiling for achieving quality results, primary advantage is that it achieves quick results. On the other hand , the libraries have a high ceiling for achieving quality results with relatively low effort.

I’d find the libraries to be more egregious because students are able to achieve substantially higher quality results with minimal understanding & effort that we are all hoping for.


I have to disagree with that. The only egregious part of @TaranMayer’s idea is the amount of auto-generated code. However, we live in the era of cheap computing resources and many professional software engineers are just as guilty in that regard.

The beautiful part of @TaranMayer’s idea is how short is human-generated portion of the code that enables reruns and how easy it would be to understand for kids who didn’t even know where to start with programming autonomous.

If something like this helps novice teams overcome their fear of autonomous, and get started with autonomous even a month earlier, then many will realize how ugly that amount of auto-generated code is and will start researching better solution, which is great, since they are actively learning.

I really disagree here as well. It is important for students to learn how to build or program something from the ground up, but it is equally important for them to learn how to find and incorporate into their code solutions developed by other people.

I’ve seen quite a few fresh computer science graduates, who may know multiple “latest and greatest” programming languages, have straight As in the advanced algorithm classes, and yet have no idea how to properly take advantage of the third party and open source libraries.

Some ignore them completely and write all their code from scratch. Others think they have to include every single library that they could download. Both of these extremes produce the code base that is hard to maintain in the long run.

It is very important to teach students the best practices and culture of incorporating third party libraries into their projects, that strikes the balance of advantages and disadvantages of using external libraries.

PROS and Okapi team are doing great job with not only providing advanced functionality to the community, but having a process where the senior teams are contributing back and participating in the open source library development.

That is how cutting edge software development process will likely look in the future and this is what we need to train our students for: cooperating with others and contributing back to the community.

I think, this is exactly what this project is doing and interpreting Student Centered policy as “everyone should rediscover everything on their own” misses the point. We need to teach students the culture of learning from others.