REPY-2.0 1.0
Mechanical module for modular robotics
|
Builds the servo horn and saves it in horn variable. --
--
Reimplemented from BasicServo. { if ( horn_num_arms != 4) { BasicServo::make_horn(); horn.relRotate(0, 0, 180); } else { //-- Construct 4-arm servo horn //-- Create axis cylinder horn = Cylinder(horn_r_axis + horn_tol, horn_h_axis +0.2, 100, false); horn.translate(0,0,-0.1); //-- Create a single arm of type 1: Component base_type1 = Cube( 2*horn_r_axis, horn_arm_shift + 0.001, horn_h_top+0.1); Component upper_cyl_type1 = Cylinder( horn_arm_r,horn_h_top+0.1, 100, true); upper_cyl_type1.translate( 0, horn_arm_dist, 0); Component arm_type1 = base_type1 & upper_cyl_type1; arm_type1.translate(0, 0, (horn_h_top+0.1) /2); //-- Create a single arm of type 2: Component base_type2 = Cube( 2*horn_arm_r_small, 0.001, horn_h_top+0.1); Component upper_cyl_type2 = Cylinder( horn_arm_r_small, horn_h_top + 0.1, 100, true); upper_cyl_type2.translate( 0, horn_arm_dist_small, 0); Component arm_type2 = base_type2 & upper_cyl_type2; arm_type2.translate(0, 0, (horn_h_top+0.1) /2); arm_type2.rotate( 0,0, 90); Component arms = arm_type1 + arm_type1.rotatedCopy(0,0, 180) + arm_type2 + arm_type2.rotatedCopy(0,0, 180); arms.translate( 0, 0, horn_h_axis); //-- Add the top cylinder: Component top_cyl = Cylinder( horn_r_top, horn_h_top + 0.1, 100, false) .translate(0,0, horn_h_axis); //-- Sum up all the parts: horn = horn + arms + top_cyl; //-- Set link on the end of the axis cylinder, to attach to the servo: horn.addLink( RefSys( 0,0, horn_h_axis)); horn.relTranslate(0,0,-horn_h_axis); } } |