Changes between Version 70 and Version 71 of Tutorials


Ignore:
Timestamp:
Nov 18, 2017, 10:34:22 AM (8 years ago)
Author:
fma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials

    v70 v71  
    540540We removed the servos mapping/calibration, as we don't need them anymore, and we just added the scene default size.
    541541
    542 == Tutorial 3 ==
    543 
    544 ''Files for this tutorial are available in [https://framagit.org/fma38/Py4bot/tree/master/py4bot/examples/tutorial_3 py4bot/examples/tutorial_3/].''
     542== Tutorial 3 - servos calibration ==
     543
     544There are different reasons why we need to calibrate your servos, depending on:
     545
     546 * how servos are attached to the robot
     547 * what servos we actually use
     548 * how accurate servos are
     549
     550'''{{{py4bot-gui-servocal.py}}}''' script can be used to fine tune our servos calibration, and generate the {{{SERVOS_CALIBRATION}}} dict.
     551
     552[[Image(py4bot-gui-servocal.png, 300px)]]
     553
     554Most 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.
     555
     556The following picture shows the usual joints positions when servos are at neutral, for a 3 DoF leg:
     557
     558[[Image(IK3DoF_neutral.png, 300px)]]
     559
     560Looking how '''Py4bot''' internally manages angles ([[UserGuideGit#a3DoFleg]]), we can see that matching joints positions are:
     561
     562 * coxa = 0°
     563 * femur = 180°
     564 * tibia = 90°
     565
     566This means that there will be some offsets between the servo angles and the framework angles.
     567
     568Another thing to tune is the servo neutral position, to correct mechanical errors.
     569
     570Last 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.
     571
     572Offsets and ratios are defined in the {{{SERVO_CALIBRATION}}} table.
     573
     574Here is how to use '''{{{py4bot-gui-servocal.py}}}'''.
     575
     576We 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).
     577
     578Then, 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.
     579
     580Next, 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.
     581
     582Once 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.
     583
     584So, 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.
     585
     586We 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)
     587
     588Note 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.
     589
     590== Tutorial 4 ==
     591
     592''Files for this tutorial are available in [https://framagit.org/fma38/Py4bot/tree/master/py4bot/examples/tutorial_4 py4bot/examples/tutorial_4/].''
    545593
    546594Here, we will see how to create a custom input frontend for a new gamepad.
     
    549597
    550598{{{
    551 $ mkdir tutorial_3
    552 $ cd tutorial_3
     599$ mkdir tutorial_4
     600$ cd tutorial_4
    553601}}}
    554602