Motor speed changes on its own

#1

Strange problem that I have never seen. A program is set to run its motors at 60, under autonomous control. When we put it into a regular RobotC file, it will run at 60. If we put the same file into the VEX competition template, it will run the motors at 127. We see this thru the motor debug window.

This wasn’t the case yesterday, as everything on the computer and robot ran as expected. I have done a master firmware download, followed by the RobotC firmware. This does not affect the outcome.

Has anyone else experienced this problem?

0 Likes

#2

Could you post your code? (Please format it with three ‘ on both sides of it for easy reading!)

That will help diagnose.

0 Likes

#3

#pragma config(Motor, port1, Right, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port7, Arm, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, Left, tmotorVex393_HBridge, openLoop, reversed)

task autonomous()
{
clearTimer(T1);
while(time1[T1] <1500)
{
motor(Arm) = 30;
wait1Msec(1500);
motor(Arm) = 0;
wait1Msec(1000);
motor(Right) = 60;
motor(Left) = 60;
wait1Msec(1750);
}

motor(Right) = -60;
motor(Left) = -60;
wait1Msec(1750);

motor(Right) = 60;
motor(Left) = -60;
wait1Msec(1000);

motor(Right) = 60;
motor(Left) = 60;
wait1Msec(2000);

motor(Right) = -60;
motor(Left) = 60;
wait1Msec(500);

motor(Right) = 60;
motor(Left) = 60;
wait1Msec(2000);

AutonomousCodePlaceholderForTesting();
}

The problem the students are having lies within the section using the timer.

0 Likes

#4

There doesn’t seem to be any issue. What are you using the AutonomousCodePlaceholderForTesting() function for?

0 Likes

#5

It has been our experience that if we don’t leave this program generated piece of code in the competition template, student programs won’t run.

0 Likes

#6

Are you using a competition controller?

0 Likes

#7

What is the point of the while loop? It is waiting for the timer to complete 1500 ms but the first wait1Msec is 1500 ms. Once it runs the series of commands the timer will be way past 1500 so essentially you are always running the while loop once. No different then not having the while loop.

I am also concerned that there are not any pauses in between the direction changes. Changing directions from -60 to 60 can be tough on a 393 motor.

	motor(Right) = -60;
	motor(Left) = 60;
	wait1Msec(500);
	
    //whew - Let me stop before changing direction.
	motor(Right) = 0;
	motor(Left) = 0;
	wait1Msec(1000);

	motor(Right) = 60;
	motor(Left) = 60;
	wait1Msec(2000);

I don’t see what could be causing the 127 speed issue. Could you post all of the code from that competition file? Are the #pragma statements at the very top?

0 Likes