Autonomous only works 3 times after download

Hello,

In the course of my programming the VEX robot microcontroller, I have developed 4 different autonomous modes. In the modes, I use a combination of 2 encoders, 1 sonar sensor, 2 potentiometers and 5 line followers.

When I download the code, it will function perfectly for the first 3 trials but then it will start doing very strange things (ie; not turn, not move backwards, not stop moving backwards).

Has anyone else experienced this problem? If so, how did you fix it?
I realize that I could simply re-download the code before each match in Dallas but this will get rather frustrating and one more thing that we need to remember to do. Especially when we are in a rush or have other problems (usually mechanical) to deal with.

Thanks!

  • Jenn

Are you using easy C?

I would think that when you develop 4 different codes, after the third trail, something goes wrong with the logic and the code does something funky, ie not turn.

One recommendation is going through the code and physically saying outloud the path that the 4 codes actually take, maybe you’ll find a problem.

Other than that I can only suggest that you post your code and we can try to debug it. :D.

It sounds like there is a problem (along the lines of a memory leak) in the software, that isn’t being detected by the compiler and linker, but has an effect that grows over time and eventually interferes with the robot’s operation after the 3rd trial.

If you post the software someone might be able to spot the problem for you.

Blake

I would guess that it’s even more simple than that. Do you reinitialize all your variables to zero? If not, there’s a good chance one or more of them are rolling over and causing your robot to do odd things.

My guess was that the microcontroller gets turned off and then back on to cause the autonomous to run for a 2nd, 3rd, … time. Hence my suspicion that something other than remembering to reinit variables is the problem.

I should have mentioned, I am using EasyC - sorry!
How can I post the entire code? It has many, many functions so it won’t really make sense. I could e-mail it to anyone who would like to take a stab at it (let me know via PM).

Most of the variables are global and the same for all 4 modes. The others are all preset as needed (ie: encoders).