Programming Motors to Increase Speed Gradually

So, I programmed the motors that drive our robot using the basic code…

motor[L_REAR_DRIVE] = vexRT[Ch3]
motor[R_REAR_DRIVE] = -vexRT[Ch2]

Now, when the VEXnet Transmitter is being used, and the joysticks are at a full 127 then to a -127 value, the robot moves quickly in the other direction and I have noticed that the robot is tipping or the gears start to skip.

I want to be able to make a program that will make the motor speeds gradually increase.

Example: You Push both Ch2 and Ch3 upwards, and so the motors will start at 0, then to 50, 75, 100 then finally 127.

But I cannot find out how to make the motors do this,
Can you help me?

There are a couple of different ways to help alleviate the sudden change from full forward to full backwards.

The first, and easiest way, is to simply slow the robot down gradually when controlling it. It’s a bit tricky to do when the robot is in the middle of a competition, but it’s the easiest way to both ensure you have the high top speed you need while maintaining the responsiveness from the controller to the robot (more on that later).

The second way is to put a soft cap on the top speed. Instead of having the values range from -127 <-> 0 <-> +127, you can set the range to a number of your choice by manipulating the joystick values. For instance:

motor[L_REAR_DRIVE] = (vexRT[Ch3])/2
motor[R_REAR_DRIVE] = (-vexRT[Ch2])/2

will net you values from -63 to +63. If you wish to have a higher top speed, you can use fractions to reach a desired value:

**motor[L_REAR_DRIVE] = ((vexRT[Ch3])5)/6;
motor[R_REAR_DRIVE] = ((-vexRT[Ch2])5)/6;

This will give you a range between -106 and +106. The advantage of using this method is that you still can use the full physical range of the joysticks, at the cost of top speed and a larger deadband (power levels low enough to send power to the motor, but not enough power to actually move it).

A third option involves using another button on the joystick to control when you are in ‘fast’ mode and when you are in ‘slow’ mode. This will allow you to slow down the movement when you are switching between directions, and then kick the robot into ‘fast’ when you are moving in the correct direction:

**if (vexRT[Btn6D] == 1)
motor[port1] = (vexRT[Ch3]3)/4;
motor[port2] = (-vexRT[Ch2]3)/4;
motor[port1] = vexRT[Ch3];
motor[port2] = -vexRT[Ch2];

The downside of this method is that the driver must press/release the button at appropriate times in order to control the speed ranges.

There are many other custom methods out there and it really does depend on the robot (gearing, weight, speed, etc) on which one will work best for you. Fortunately, we do have a video trainer that deals specifically with joystick mapping (under Remote Control -> Joystick mapping) if you are interested.