Robot has motor spasm, help fix

I have a robot that I had programmed, it uses 8 motors at the same time on the microcontroller, and a power expander. When I use the robot, it moves correctly and all, but it has a lot of “motor spasm”. I make it drive, it works fine for 2 secs, then the motors start glitching. If I make it drive and move something else too, it does even more “motor spasm”. I can’t fix it, I tried re-programming and updating many times.

I’m using easyC V2 for Vex for programming.
The code is provided, please take a look.

All help is appreciated.

Thanks in Advance.

P.S. I’m going to the competition tomorrow at BCIT, help needed ASAP. Thanks.
Clean Sweep Test.zip (2.61 KB)

Is all your doing trying to make the motors be controlled by the controller? I.E. Up on stick one makes motor1 go foward? It looks like the program has a variable being set as at a diferent value for the same variable. I.E. MLR = MLR - 127. If you solve this algebraicly, you get 0 = 127 when actualy 0 =/= 127. This might be the main problem.

I don’t think there’s anything wrong with the variable. When I just move a few motors it works fine, but when I move all of them, it starts having a spasms again. It sometimes works fine too. I double checked the math and all of the programming; it directly follows what’s here: https://vexforum.com/t/answered-can-license-plates-be-oriented-sideways/27784/1&highlight=holonomic, except it’s got a few more motors.

It tried the program again, this time with only Motor1, 2, and 3, and it worked fine without twitching or anything. Is there something I’m not getting?

i think its your connection problem
is your antenna AWAY from metal?
and is your r3eciever cable loose? (the yellow cable)
this happened to us too
but when we tried using tether, it was fine
we ended up replacing the reciever

quote “is your antenna AWAY from metal?”

uhh… i didn’t know the antenna needed to be away from metal >.< I wrapped it around a huge metal piece actually, this might be the problem, I’ll undo that and see what happens. I’ll post results later.

Thanks.

leaving for competition now xD

great competition

it turns out we had the antenna too close to metal so we moved it. it was a lot better, there was still twitches but it was play-able, the other twitches was from overloading… 10 motors running continuously at many points in game with power expander, and sometimes 4 motors off the robot microprocessor all running at full capacity, stalling.

i wish vex has better batteries, for battery life and power >.<