Intermittent Motor Issues

For the last year or so, we have been having an intermittent problem with our motors. Currently, our robot has four drive motors, four arm motors, and a stabilizer motor. The drive and stabilizer motors work perfectly fine, but the arm motors are another story. They turn without a problem in one direction, but cut in and out in the other direction.

We had the same problem last year where one side of our flywheel kept cutting out and never were able to figure it out. It has gotten significantly worse though and can no longer be ignored. We are using a fully charged battery and 9V battery. For testing purposes, none of the motors are under any load and they still have the problem. We have also distributed the motors evenly across the cortex to avoid tripping circuit breakers.

We know that the motors are mechanically fine, because when we only program the arm without the drive they issue seems to go away. We also know that it isn’t the controller as we have tried using different button sets and both of our controllers, along with both sets of VEXnets and a direct connection. To make sure that we really have covered all our bases, we also tried using a different cortex to no avail. Our simple testing code is below. We tried to eliminate anything that wasn’t completely essential until we get this figured out. Thank you for any insight you may have. VEX Tech Support didn’t have any idea what could be causing this. I have also attached a video that better demonstrates the problem.

motor problem video

#pragma config(Motor,  port1,           stabilizer,    tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port2,           DL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           UL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           FL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           FR,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           BL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           BR,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           DR,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           UR,            tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main() {
	while(true) {
		if(vexRT[Btn6D] == 1){

			motor
 = -50;
			motor[UR] = -50;
			motor[DR] = 50;
			motor[DL] = 50;
		}
		else if(vexRT[Btn6D] == 0){

			motor
 = 0;
			motor[UR] = 0;
			motor[DR] = 0;
			motor[DL] = 0;
		}

		if(vexRT[Btn6U] == 1){

			motor
 = 50;
			motor[UR] = 50;
			motor[DR] = -50;
			motor[DL] = -50;

		}
		else if(vexRT[Btn6U] == 0){

			motor
 = 0;
			motor[UR] = 0;
			motor[DR] = 0;
			motor[DL] = 0;
		}

		if(vexRT[Btn8U] == 1){								// Stabilizer

			motor[stabilizer] = 100;
		}
		else if(vexRT[Btn8D] == 1){

			motor[stabilizer] = -100;

		}
		else{

			motor[stabilizer] = 0;

		}

		//Drive

		motor[FL] = vexRT[Ch3];
		motor[BL] = vexRT[Ch3];
		motor[FR] = vexRT[Ch2];
		motor[BR] = vexRT[Ch2];

	}
}

Answer this… what are you telling the lift motors to do if 6D is pressed and 6U is not pressed? What if both are pressed? You cannot give multiple instructions to a single motor. Every if condition must be unique. Rewrite those statements such that all 4 possibilities of 6U+D presses are accounted for, and the 3 motion possibilities are assigned.

It is common to use if, else if, else for this sort of situation (like you did for the stabilizer)

if (up button is pressed) { motor = up; }
else if (down button is pressed) { motor = down; }
else { motor = stopped; } // true if neither is pressed

The first correct condition will be executed.

In code that looks like this:

#pragma config(Motor,  port1,           stabilizer,    tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port2,           DL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           UL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           FL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           FR,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           BL,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           BR,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           DR,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           UR,            tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main() {
	while(true) {
		if(vexRT[Btn6D] == 1){

			motor
 = -50;
			motor[UR] = -50;
			motor[DR] = 50;
			motor[DL] = 50;
		}
		else	if(vexRT[Btn6U] == 1){

			motor
 = 50;
			motor[UR] = 50;
			motor[DR] = -50;
			motor[DL] = -50;

		}
		else{

			motor
 = 0;
			motor[UR] = 0;
			motor[DR] = 0;
			motor[DL] = 0;
		}

		if(vexRT[Btn8U] == 1){								// Stabilizer

			motor[stabilizer] = 100;
		}
		else if(vexRT[Btn8D] == 1){

			motor[stabilizer] = -100;

		}
		else{

			motor[stabilizer] = 0;

		}

		//Drive

		motor[FL] = vexRT[Ch3];
		motor[BL] = vexRT[Ch3];
		motor[FR] = vexRT[Ch2];
		motor[BR] = vexRT[Ch2];

	}
}

There are only 3 states you need to account for: 6U, 6D, or nothing. Thus, you don’t need two separate if statements; one should be all you need. Really never use multiple if statements to control the same motors.

Yes of course! Thank you! Such a simple thing. That is how we usually have our stuff programmed, but for some reason we didn’t do it here. We will give it a try as soon as we can. Thank you both for your quick responses!