You have just written a proportional (or P) controller. For more about this and the related PID controller, see
http://en.wikipedia.org/wiki/PID_controller.
When you say it jitters, do you mean that it gets to where it needs to go, and then it oscillates back and forth? I'm going to show you another way to look at the code you wrote that might make it easier to tweak:
Code:
pot_0 = controller potentiometer
pot_1 = on motor
mot_0 = motor
float Kp = 1.0;
float error = (pot_0.value() - pot_1.value())/1024
mot_0.Set( Kp * error )
This is closer to the "standard form" of a controller. Now Kp is your "gain" factor - you can tweak it so that you achieve the balance of speed and oscillation that you desire. With Kp = 1.0, this should be equivalent to the gain in the code that you showed. It sounds like since you are oscillating, you might want to reduce it. Now you might encounter some other issues, however. Use the article I linked to to see how you might resolve these.
You shouldn't need to worry about the case that Kp*error is greater than 1 (or less than -1) because the PWM::SetSpeed() function (which is called by Jaguar::Set() or Victor::Set()) will make sure it is in the right range. And if you are worried about not having any error tolerance, you can do the following in place of casting to an int:
Code:
... stuff from above here
if( mot_0.Get() > -.1 && mot_0.Get() < .1 )
{
mot_0.Set(0.0);
}
Hope this helps!