Notice: This page contains information for the legacy Phidget21 Library. Phidget21 is out of support. Bugfixes may be considered on a case by case basis. Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21. We recommend that new projects be developed against the Phidget22 Library.
|
Template:ServoCalibration: Difference between revisions
(Created page with "Each servo behaves slightly differently. The Phidgets API provides calibration parameters for a number of different models of servo motors; however these values are generic wi...") |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 20: | Line 20: | ||
<code>setServoParamters(min_us, max_us, degrees, velocity_max)</code> | |||
setSevoParameters has 4 arguments, min_us is the minimum μs value you recorded, max_us is the max μs value, degrees | setSevoParameters has 4 arguments, min_us is the minimum μs value you recorded, max_us is the max μs value, degrees is the range measured with the protractor, and velocity_max is the maximum rated velocity from the data sheet in degrees per second. | ||
|}} | |||
| | |||
}} | |||
For example: | For example: | ||
Line 51: | Line 44: | ||
|- | |- | ||
|style="background: #f0f0f0" align=left|degrees | |style="background: #f0f0f0" align=left|degrees | ||
|style="background: #f0f0f0" align=left| | |style="background: #f0f0f0" align=left|180 | ||
|- | |- | ||
|style="background: #f0f0f0" align=left|velocity_max | |style="background: #f0f0f0" align=left|velocity_max | ||
|style="background: #f0f0f0" align=left| | |style="background: #f0f0f0" align=left|316 | ||
|- | |- | ||
|} | |} |
Latest revision as of 16:34, 29 July 2013
Each servo behaves slightly differently. The Phidgets API provides calibration parameters for a number of different models of servo motors; however these values are generic with respect to the model and not specific to each individual unit. It is possible to generate your own values through some manual calibration in the event that your application requires very accurate control or if you are using a servo for which default values are not provided. This is done as follows:
Open the Phidget control panel and open the GUI for the servo controller. |
||
Plug your servo in and set the servo type to RAW_us_MODE. | ||
Choose the correct servo motor (based on what pins the motor is connected to) and then starting with the target position slider in the approximate middle, engage the motor. The motor should move into position. Move the target position slider to the left until the motor stops turning. The servo should stop before the slider hits its limit. Take note of the value at which the motor stops, the more precise you can be the better but the nearest multiple of 10 is usually sufficient. This is the low μs value and will be used later. Move the slider to the right and again take note of where the servo stops turning. This will be the high μs value. Using a protractor, measure the actual range of movement of the servo motor. This should be close to the rated value but it will likely not match exactly. Accuracy to the nearest degree is good enough. To do this start with the motor at one extreme. Mark a spot on the motors output shaft in line with 0 degrees and then rotate the motor to its other extreme. Take the value of where the mark you made now rests and that is the motor’s full range of motion. For linear actuators, retract the arm all the way, mark the position of the end of the arm, extend it to its maximum length, and then measure the distance in millimeters from the end of the arm to the old position. Finally, check the motor’s data sheet to see the maximum rated velocity. Now that all the measurements have been taken, you can use
|
For example:
The HITEC HS-322HD used in testing has the following parameters:
Argument | Value |
---|---|
min_us | 630 |
max_us | 2310 |
degrees | 180 |
velocity_max | 316 |
So for example, in C# to initialize the specific HS-322HD tested the following change would be made to the
AdvancedServo example code in the advServo_Attach function:
void advServo_Attach(object sender, AttachEventArgs e)
{
...
//Set the default servo type to the one Phidgets sells
foreach (AdvancedServoServo motor in attached.servos)
//motor.Type = ServoServo.ServoType.HITEC_HS322HD;
motor.setServoParameters(630, 2310, 9, 2949);
...
}
Your program has now been calibrated to your servo motor. You can get calibration parameters for multiple motors and
use all of them in one program should you require it.