There are currently 0 users and 2 guests online.
C++ Library for $50 Robot Version 1
6 - Tweaking the servos
Submitted by Webbot on April 27, 2008 - 10:52am.
If you have previously modified a servo then you may have noticed that their peformance can change depending, not only on how well you centered the pot, but also on external things like voltage levels etc.
To tune the code to your servo then you may need to fiddle with the following lines:-
SERVO g_servoLeft( 'D', 2 , &g_timer, true, 1500, 300);
The last 3 parameters do the following:-
true or false - indicates if one of the motors is flipped.
1500 - This represents the value to center the servo. In this case it means 1.5ms which is the default value for centering a servo.
300 - This represents the deviation on either side of the previous value. ie from 1.2ms to 1.8ms.
So to center your servos then change the last parameter to 0. This means that no matter what your code is trying to do it will always go at the speed set by the 1500 parameter. If 1500 doesn't keep your wheel stationary then tweak with the 1500 value until it does. You can then experiment with the second value so that you get the required variation in speed control. I then label each of my servos with the settings that works best for them.
The same thing applies if you are using the PWM version of the motor control.