Autonomous works then doesn'

Team mom here trying to help our middle school kids solve our current frustration. Our autonomous programs works sometimes and doesn’t other times even if we don’t change ANYTHING! Same code, same setup, same field…it’s maddening. Happens to us nearly every competition and even sometimes during practice. First run in the morning - all is well. Second run (no changes) - complete fail. Robot goes way off course as if it’s using some other code that they didn’t program. Then we descend into the pit of trying to re-code to compensate for {insert ideas about why this is happening here - slippy field, slippy wheels, minute variations in setup…} or restarting, or wiping the controller and reloading everything, and even crying…you name it, we feel like we’ve tried it but with next to no success.

I know finding a definite reason might be absolutely impossible but I’m hoping someone can give me some tips about how to proceed more efficiently. Our random guesses are clearly not working. We’re using V5 and have had a host of issues with our brain disconnecting, motors burning out, and the like. We are also having issues with autonomous not working but our brain/controller freezes for the one minute countdown and we’re forced to restart it. Super awesome during skills runs.

Anyway, thanks for any direction you can give us.
70857M PyroPigeons

sounds like you just have a very inaccurate auton. if you use sensors you can increase the accuracy of your auton.

post the code and perhaps some photos pf the robot.

Your battery is probably just weaker the second time. If you program the autonomous off of time, then a lower battery voltage will lead to your robot turning less, which could be the cause of your problem. As @Xenon said, sensors can help you program a more reliable auton, as they go off of ticks, rather than time

It sounds like you’re forgetting to set the encoders to 0.

this could be the issue, if they are even using encoders

I might be wrong but wouldn’t this not matter if they are using the rotate for command ?

oh lol I’m using cortex stuff, so I assumed they are too. but yeah, your right, It wouldn’t matter since it seems like they’re using v5.

Instead of using a “motor.rotateTo” use “motor.startRotateFor”, this way you won’t have to worry about coding a reset for the built in encoders. I had this same issue and it costed us a tournament, I assume you do as well considering that your driver control works. (I assume)

All teams have this problem at first and then realize that consistency is the hardest part of making an autonomous program. Based on what you’ve written, it seems as though your team is using wait times or very basic encoder movements. While in theory, these are great, there are many factors that must be considered when making an autonomous routine for the real world. I’ll describe the problem with using time based movements.
The first issue is wheel slippage. The wheels must grip the ground for the robot to move. If the wheels begin rotating, but the robot does not move for even a few milliseconds, some of that time spent “moving” was actually wasted. As a result, the robot thinks it is farther than it actually is.

The next issue is speed differences. Nothing in the real world is perfect. As a result, the robot’s wheels could spin at slightly different speeds each time you rotate them. If you run your autonomous once, and wheels are going at a slightly slower than normal speed, it might move 35 inches. The next time you run it, the wheels might be faster and it could move 38 inches.

There are tons of factors that I’m sure you could come up with now. You need to account for as many of these problems you can in your autonomous functions. It will take time and progress will be slow, but know that if you keep working at it, it will work eventually.

Now, for some possible solutions: Using encoders will help moving the drive base around accurately (encoders are built into the V5 motors), gyros are incredible for turning, and potentiometers are great to measure position on arms and such. Have your team brainstorm as many possible problems they can come up with and implement solutions in their code. If you have any specific questions, feel free to let me or anyone else know. Regardless, we will all be able to assist you more specifically if you post pictures of the robot and post the program being used.

With my experience with this same issue I would recommend taking the following steps:

  1. If you are using time to run your autonomous, try doing research to learn how to use the encoders
  2. Practice using those on very basic autos. For example, see exactly how many rotations it takes to move a foot. If you have an experienced or eager to learn coder use that to make functions where all you need to do is input a distance.
  3. slowly start making your auto, when doing this do repeated trials each time you run it, and go one movement at a time.
  4. Don’t expect perfection, the more sensors you use the closer you will get but it will never truly work 100% of the time.

I’ve had your issue for the 2 of my 3 years in this and it was just this recent year we really started getting this system down and it had really worked well for our autos, so if you have any other questions feel free to ask!

Thank you all so very much. I’m printing out this whole thread and sharing with my team at practice this week. I know we’ve done a few of these already (switched to rotations vs time) but there’s a lot here for us to try still. I’m very encouraged!!!

I would also add the following. Build your autonomous in stages and test each stage independently to make sure it works the way you expect. for example:
Step 1) Drive forward x feet. Code that part (and if you have other parts of the autonomous already written, comment them out) and test it over and over until you get a reasonable amount of consistency.
Step 2 Code the second movement and comment out everything else. Place the robot where the first movement ended and test the second movement until you get some consistency.
Repeat above for each action that your autonomous performs.
Then run your first and second actions together and test and adjust until it is somewhat consistent. Then add your third action, repeat with each succeeding action.

with this strategy make sure you test with different batteries with different levels of charge, voltage can change it a lot. also make sure that the robot’s velocity from the previous stage doesn’t effect the next.