Randomly skipping auton steps

We occasionally have issues where our autonomous routines seem to skip steps. For example, in one instance our robot may decide not to make one of its turns (we use gyro) and another time it may decide to not drive the proper distance (we use IMEs). Last week at a scrimmage, twice our robot stopped in the middle of the autonomous routine all together, but each time at a different point in the code.

A bit about our code: We use tasks to compartmentalize our code. Related to autonomous, we have all of our autonomous functions defined in one task file (AutonomousFunctions.c) and our autonomous runs defined in a different task file (AutonomousRuns.c). The autonomous code is nothing more than a string of commands using the defined functions. For example, Drive(distance,power); Turn(degrees,power); etc.

We had the same issue last year as well. Anyone have similar issues and ways to resolve?

So to clearify, you have no PID code in there?

@9364F We have separate tasks for the Lift and Claw that both use PID, but no PID is defined for the move and turn functions. In our autonomous programming code, we define the target values for the claw and lift.

Have you tried running autonomous while looking at your sensor values in the debugger?

Okay I just want to say that you should never use IME’s. I’m not sure how many people know or agree with this, but IME’s are so faulty. If you can switch to quadrature encoders. Next, you may not “see” some of the tasks being performed because you may not have delays integrated between each task. Putting a time delay between each tasks allows your robot to accurately execute the task.

I completely agree

I absolutely agree. We have had horrible luck with them

Is your autonomous a series of functions or do you actually start and stop a bunch of tasks? The wording of your post has me wondering. Ours is just a switch depending on the auton with 2 other tasks that run to control the arm and claw PID’s. They just step through the switch case, but we switched to all Quads except for a potentiometer on the lift arm.

I don’t know why but our gyroscope either drifts or somehow I have a programming error, but whenever the robot reaches the white stripe for the first time, the robot turns for absolutely no reason… Like, I double, triple, and quadruple checked that area of the auton in the program and yet it still seems to have the same exact issue no matter what change I made:

These have happened to us, as well. The cause is your cortex or sensors misreading their values initially. The solution is to put small waits (100ms or so) in between each function, and double each function so that it runs the same code twice, making it more likely to obtain the proper angle/distance (Stats!). And don’t use Integrated Encoders.

Maybe some of your encoders are wrong? Do you have tolerances set for the angle that the robot needs to be at? Maybe the tolerances are too high.