# controlling robot speed in RC mode

Hi!!
I am new to Vex Robot programming. We have a competition coming up in our school where we are supposed to run our robot in RC-mode on a racing track and complete the lap in less than three minutes. We are using easy-C for programming our robot. I am having some trouble in handling the robot as one of our motor module runs faster than the other. I was wondering if there was any way to control the speed through some programming code,etc. to make both the motor modules work at the same speed?!?!
Thanks!!

Look into using VEX encoders, they send you data about exactly how fast a motor is running, then you can use that data to tell the motors to run at the same speed verses running at an ambiguous value.

If your motors are running at significantly different speeds, it’s good to look for mechanical answers first.

1. Are the motors the same type? If they are high strength motors, do they have the same internal gearing?

2. Is there significant friction on one side, or an imbalanced load? Try picking up the robot and running the motors “in air” to see what the speeds on each side look like.

You can program the motors to run at different levels of R/C sensitivity, but this is more difficult than balancing mechanically.

Are you using EasyCv2 (for PIC) or EasyCv4 (for Cortex)?

In v4, the “stop” position is 0, with 127 at full CW and - 127 at full reverse. If you want to slow down one of the motors, you can store the input from a joystick (say 2) to a variable, then scale it.

In pseudocode:

declare constant Gain = 0.8 (or any number between 0 and 1)
declare variable Ch2input, Ch2power

while (1==1)
Ch2input = GetJoystick(2)
Ch2power= Gain*Ch2input
Setmotor(2,Ch2power) //Motor port 2
end while

For v2, you do something similar, but you have to subtract off 127 before scaling, then add it back on before setting the motor, because the “stop” motor position is at 127. Also in V2, use GetRxInput, rather than GetJoystick.

You’ll need to use floating point (not integers), because gain< 1.

Lastly, there’s a lot more Vex-related traffic on Vexforum.com, so you might get more/faster answers there.

Thanks a lot that was very helpful!