REPY-2.0 1.0
Mechanical module for modular robotics
void TowerProSG90servo::update_horn ( ) [protected, virtual]

Sets the different default dimensions of the horn after a change in the horn main characteristics.

Implements BasicServo.

{
    //-- Horn tolerance
    horn_tol = 0;

    //-- Color (white)
    horn_color.push_back( 1); //-- Red
    horn_color.push_back( 1); //-- Green
    horn_color.push_back( 1); //-- Blue
    horn_color.push_back( 1.0); //-- Alpha channel

    //-- Set parameters depending on the number of arms of the servo horn:
    //--------------------------------------------------------------------
    switch( horn_num_arms )
    {
    default:
        horn_num_arms = 1;

    case 1:
        //-- 1-arm horn:
        horn_h_top = 1.7;
        horn_r_top = 7.2 / 2.0;
        horn_h_axis = 2.7;
        horn_r_axis = 7.2 / 2.0;
        horn_arm_r = 3.6/2.0;
        horn_arm_shift = 0;
        horn_arm_dist = 19.6 -horn_r_top -horn_arm_r;
        break;

    case 2:
        //-- 2-arms horn:
        horn_h_top = 1.7;
        horn_r_top = 7.2 / 2.0;
        horn_h_axis = 2.7;
        horn_r_axis = 7.2 / 2.0;
        horn_arm_r = 3.6 / 2.0;
        horn_arm_shift = 0;
        horn_arm_dist = 32 /2.0 - horn_arm_r / 2.0;
        break;

    case 4:
        //-- 4-arms horn:
        horn_h_top = 1.7;
        horn_r_top = 8 / 2.0;
        horn_h_axis = 2.8;
        horn_r_axis = 7.2 / 2.0;
        horn_arm_r = 3.6 / 2.0;
        horn_arm_shift = 7;
        horn_arm_dist = 18 - 4.5 / 2.0;

        //-- Extra parameters:
        horn_arm_r_small = 3.8 / 2.0;
        horn_arm_dist_small = 16.8 / 2.0 - horn_arm_r_small;
        break;
    }

    rebuild();
}
 All Classes Functions Variables