Quad Encoder Issues

Whenever i was programming my autonomous for skills, whenever it drives forward, after a certain amount of time, the left drive will stop moving for a quick second or two causing it to turn and not score a mobile base, it does this for basically all the program except the first movement to the first mobile base

Heres the code:
Vex Forum Code.pdf (151 KB)

Looks like the code is missing.

@kypyro haha i got it uploaded now

Ugh. All that spacing makes the document huge and hard to read through. I did notice some other things:

  1. Driving backward you set the master to -125. That doesn’t leave much room for the other side to overpower it. You noted you only went to 120 forward for this reason, though this still doesn’t leave a ton of room. But -125 gives essentially none.

  2. In the same function you brake for 250 ms. That’s so long I’m pretty sure you’ll do more than brake. for a short bit.

  3. Going straight from 120 to -25 or -125 to 25 in very little time isn’t great for the motors.

@callen how’s it bad for the motors, and how could i fix it? i’m guessing you mean the big change in speed happening so fast could essentially burn them out?

Motors contain coils. Coils fight against rapid changes in current. So if you suddenly change the current through a coil, you can get a large, momentary voltage fighting you. This can be enough to damage things in the circuit (burn them out - more likely the motor controllers than the motors). This is why, when we teach electronics, we have people place a diode in parallel with any coil being used if possible. This protection diode give an alternative route for current to travel through if the coil tries to ram current through the rest of the circuit, while it doesn’t interfere with the current sent to the coil due to its one-way-valve functioning.

The solution is to slow down more steadily (slew rate control). As you get closer, start slowing down so you’re going slower and slower as you reach your target, just like you would do if you’re going 55 mph down the highway toward a red light with cars stopped. You wouldn’t go 55 mph until super-close and slam on the brakes in hopes you could screech to a stop in time; instead you would slow down more gently. This will also cut down on the need to throw the motors into reverse to stop the robot in the end. You might still need to, but it won’t be so dramatic.