Jerky Turns

So, I solved my problem in my other thread, but I have a new problem!:confused: My robot turns jerkily, and I think it has to do with the amount of code it has to sift through to indentify turning speed. Here is the code(new and improved):

The issue you are most likely encountering is due to there being several joystick values that, when reached, will turn off the motors.

For example, you have accommodated for what happens when the joystick values are less than 100, and what happens when the joystick values are greater than 101, but what happens when the joystick values are equal to 100, or 101?


//If the joystick value is greater than 51 and less than 100
//run this code
else if(vexRT[Ch1] > 51 && vexRT[Ch1] < 100)
{
motor[left] = 100;
motor[right] = -100;
}

//If the joystick value is greater than 101 and less than 128
//run this code
else if(vexRT[Ch1] > 101 && vexRT[Ch1] < 128)
{
motor[left] = 127;
motor[right] = -127;
}

//If the joystick values are equal to 100, 101, or any other other 'unaccounted for' values
//The motors will be stopped, causing jerky movement
else
{
motor[left] = 0;
motor[right] = 0;
}

You will need to tweak the if/else statements to account for these ‘unaccounted’ for values (which will cause the else statement, a stop motors behavior, to execute) to account for this jerky movement.

Thank You!:slight_smile:

It’s our pleasure. I’m linking to James Pearman’s relevant post (found here) which also has several relevant fixes you may want to look at as well.