Robot pausing during a program

In my code, the robot sometimes pauses, usually before a turn, even though the pause is not included in the code. After the pause, the robot sort of jitters to one side before continuing the code, and it’s messing the whole program up. What might be causing this?

Are you using the gyro sensor at all?

A LOT of different things.

One nice thing to check up on is that you aren’t running directly after unplugging the controller from the computer. After you unplug the controller, it will stay connected for 10 seconds, and then disconnect for a second before reconnecting. If your controller isn’t turning red, it probably isn’t that.

Apart from that, plenty of different problems could cause this. If you post your code, we can see if it is a problem inside of your code (be sure to use [code] ... [/code] tags to format it in the forum).

2 Likes

I am, but I’ve never encountered this kind of problem when using a gyro before.

This is the code:

1 Like

What part of the code does it usually mess up on? Or is it general to all turns?

1 Like

There’s no pattern that I can see for when it messes up, but it’s usually on one of the earlier turns.

Each of the drivetrain commands are a “blocking” command. If they don’t reach their target (hit a mechanical stop, too much resistance in the drivetrain preventing it from reaching a certain amount of rotation) it will cause the program to wait until the target is reached - giving the impression of a “paused” program.

You can look at using the “set drive timeout” command to set effectively a “time limit” for each command - it’ll move to the next command once the target is reached OR when the time limit is reached (whichever comes first).

6 Likes

I don’t think that’s it. The robot doesn’t have anything in front of it when it stops, and there’s nothing to block it or prevent the wheels from turning.

Could try running it off the ground and see if it stops.

1 Like

Friction? Picture of robot drive train would help. One test I have students test the wheels/drive shafts on the robot without being connected to motors. Ideally, spinning the wheels should have them spin for a while. If they dod not - friction is an issue. Most of the time wheels do not spin freely, usually indicating frame is not square, so shafts and rubbing on bearing flats.

2 Likes

Try switching out the gyro.