Changes between Version 69 and Version 70 of UserGuideGit


Ignore:
Timestamp:
Nov 17, 2017, 6:54:14 PM (8 years ago)
Author:
fma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuideGit

    v69 v70  
    151151=== Servos calibration ===
    152152
    153 There are different reasons why you need to calibrate your servos, depending on:
    154 
    155  * how you attached your servos to the robot
    156  * what servos your actually use
     153There are different reasons why we need to calibrate your servos, depending on:
     154
     155 * how servos are attached to the robot
     156 * what servos we actually use
    157157 * how accurate servos are
    158158
    159 You can use the '''{{{py4bot-gui-servocal.py}}}''' to fine tune your servos calibration, and generate the {{{SERVOS_CALIBRATION}}} dict.
     159'''{{{py4bot-gui-servocal.py}}}''' script can be used to fine tune our servos calibration, and generate the {{{SERVOS_CALIBRATION}}} dict.
    160160
    161161[[Image(py4bot-gui-servocal.png, 300px)]]
    162162
    163 Most servos have a range of 180°. So, it is important to mount them on the robot so the servo neutral position (''SNP'') matches the joint neutral position (''JNP''). Here is the leg neutrals usually used for a 3 DoF leg:
     163Most servos have a range of 180° (more or less), and their neutral position (mid-range) is around 1500µs. It is important to mount the servos on the robot so the we can reach the joints positions ranges we want.
     164
     165The following picture shows the usual joints positions when servos are at neutral, for a 3 DoF leg:
    164166
    165167[[Image(IK3DoF_neutral.png, 300px)]]
    166168
    167 This position should be reached when servos pulses are 1500µs (1500µs is the neutral pulse of hobby servos). It may vary a little bit, and you can fine tune this value by scanning the mechanical range of the servo, and take the middle value (neutral_pulse = (min_pulse + max_pulse) / 2). A little servo tester can be helpful.
    168 
    169 In the above position, ''SNP'' are all 0°.
    170 
    171 Looking how '''Py4bot''' internally manages angles ([[UserGuideGit#a3DoFleg]]), we can see that in this position, ''JNP'' are:
     169Looking how '''Py4bot''' internally manages angles ([[UserGuideGit#a3DoFleg]]), we can see that matching joints positions are:
    172170
    173171 * coxa = 0°
     
    175173 * tibia = 90°
    176174
    177 This means that there will be some offset between the servo angles and the framework angles.
    178 
    179 Another thing to tune is the ratio between pulse variation and real servo displacement. This ratio varies a lot from a brand to another. And even for a same model, it varies from a servo to another. This is especially true for low cost servos.
    180 
    181 Offsets and ratios are defined in the {{{SERVO_CALIBRATION}}} table. This table also has a '''neutral''' param, to fine tune the ''SNP'' (it is not always possible to mount the servo so 1500µs is the perfect ''JNP'').
     175This means that there will be some offsets between the servo angles and the framework angles.
     176
     177Another thing to tune is the servo neutral position, to correct mechanical errors.
     178
     179Last thing to tune is the ratio between pulse variation and real servo displacement. This ratio varies a lot from a brand to another. And even for a same model, it varies from a servo to another. This is especially true for low cost servos.
     180
     181Offsets and ratios are defined in the {{{SERVO_CALIBRATION}}} table.
    182182
    183183Here is how to use '''{{{py4bot-gui-servocal.py}}}'''.
    184184
    185 We first need to enable the servo, by clicking the '''Enable''' checkbox. Then, we need to check if the servo rotates the right direction: increasing the pulse value should increase the joint angle (= make in turn in the trigonometric sense in the leg coordinate system). If it is not the case, click the '''Invert''' checkbox (usually, coxa joints are all the same, and other joints should be inverted for legs of one side, but it depends if there is a symmetry in the mechanics or not). Note that from within this tool, the servo direction won't change! But the ratio is inverted, so '''Py4bot''' will compute angles the right way.
    186 
    187 We are now ready to fine tune the ''SNP'', and set its matching ''JNP''. To do this, we move the '''Pulse''' slider until we mechanically reach the ''JNP''. Then, we move the '''Joint neutral''' slider to match the theoretical ''JNP'' for that specific joint (as we seen, coxa = 0°, femur = 180°, tibia = 90°). Then, we click the '''Set pulse''' button of the joint neutral setting. This recomputes the '''offset''' and '''neutral''' params of the {{{SERVO_CALIBRATION}}} table.
    188 
    189 Then, we need to tune the ratio. This step is a little bit harder, as we need to measure the angle the joint really moves. The best way is to move up to +-90°, as it is visually easy to see, but it is not always mechanically possible, and we can restrict the range to +-45°.
    190 
    191 So, we move the 'Angle min' slider to -45°. Then, we move the '''Pulse''' slider so our joint really reaches -45°. Last, we click the '''Set pulse''' button of the '''Angle min'' slider to recompute the ratio.
    192 
    193 We of course need to repeat the procedure for the angle max. After both have been tuned, the ratio should be correct.
    194 
    195 And we need to repeat the entire procedure for each servo/joint, which can be tedious for a 4 DoF hexapod :o/ But after that, our robot should walk better ;o)
    196 
    197 Note that if we already have a '''{{{settings.py}}}''' module, we can launch '''{{{py4bot-gui-servocal.py}}}''' from the directory containing that module in order to reload the previous values.
     185We first need to enable the servo, by clicking the '''Enable''' checkbox. Then, we need to check if the servo rotates the right direction: increasing the pulse value should increase the joint angle (= make in turn in the trigonometric sense in the leg coordinate system). If it is not the case, we just click the '''Invert''' checkbox (usually, coxa joints are all the same, and other joints should be inverted for legs of one side, but it depends if there is a symmetry in the mechanics or not).
     186
     187Then, we can set the offset as shown above by moving the '''Offset''' slider. This has no impact on the servo position, but changes the table offset.
     188
     189Next, we need to fine tune the servo neutral position. To do this, we move the '''Neutral''' slider until we mechanically reach the correct neutral position.
     190
     191Once this is done, we can adjust the ratio. This step is a little bit harder, as we need to measure the angle the joint really moves. The best way is to move up to +-90°, as it is visually easy to see, but it is not always mechanically possible, and we can restrict the range to +-45°. But we have to keep in mind that the larger the angle is, the better the accuracy will be.
     192
     193So, we move the '''Test Angle''' slider to 45°. Then, we move the '''Ratio''' slider so the joint really reaches 45°. Finally, we can check if going to -45° moves the joint to the symmetrical position.
     194
     195We of course need to repeat the entire procedure for each servo/joint, which can be tedious for a 4 DoF hexapod :o/ But after that, our robot should walk better ;o)
     196
     197Note that if we already have a '''{{{settings.py}}}''' module, we can launch '''{{{py4bot-gui-servocal.py}}}''' from the directory containing that module in order to reload the previous values. And if the module contains a '''{{{LEGS_SERVOS_MAPPING}}}''', the script will show the legs/joints names. So, it is better to start writing this param, before launching the script.
    198198
    199199== Gaits and !GaitSequencer ==