I was “testing” (playing with) my robot today, and one of the motors started to move the wrong direction. I looked in my program and found nothing wrong.
if(vexRT[Btn6U] == 1)
{
motor[Lift1]=100-LiftDifSpeed*27;
motor[Lift2]=100-LiftDifSpeed*27;
motor[Lift3]=100+LiftDifSpeed*27;
motor[Lift4]=100+LiftDifSpeed*27;
}
else if(vexRT[Btn6D] == 1)
{
motor[Lift1]=-100-LiftDifSpeed*27;
motor[Lift2]=-100-LiftDifSpeed*27;
motor[Lift3]=-100+LiftDifSpeed*27;
motor[Lift4]=-100+LiftDifSpeed*27;
}
else
{
motor[Lift1] = 10+vexRT[Btn8U]*50-vexRT[Btn8D]*60;
motor[Lift2] = 10+vexRT[Btn8U]*50-vexRT[Btn8D]*60;
motor[Lift3] = 10+vexRT[Btn7U]*50-vexRT[Btn7D]*60;
motor[Lift4] = 10+vexRT[Btn7U]*50-vexRT[Btn7D]*60;
}
(I took the green stuff out:p)
Here’s a video of it.
Well… I checked again without changing anything, and it’s fixed now.
Video right here
We are going to replace port 6 (Lift 3 in program) though.
Hopefully, this doesn’t happen at a competition because it’s a real source of panic.
If anyone else has a problem like this, well, I think that some motors need to be warmed up 
After glancing at the video, I would suspect that one of your motors became temporarily disconnected. It might only appear to be going in reverse as your pinion shafts start to bend a little under the load and cause gears to “walk” over each other a little.
EDIT: I would look carefully for loose connections, possible motor wires being pinched and shorted, or be on the lookout for a motor that is failing intermittently.
I’m no expert in control software, but I’ve never seen code like yours before. To me it seems maybe overly complex??? Could you explain it a little? Or maybe post the code with its original comments?
The LiftDifSpeed looks at the difference between the encoders and sees if it’s over a certain number (30 encoder counts in my code). It speeds up and slows down each motor accordingly. I just thought this would be the best way to incorporate the IMEs.