REPY-2.0 1.0
Mechanical module for modular robotics
|
Builds the servo horn and saves it in horn variable. --
Reimplemented in TowerProSG90servo. { //-- Create axis cylinder horn = Cylinder(horn_r_axis + horn_tol, horn_h_axis +0.2, 100, false); horn.translate(0,0,-0.1); if (horn_num_arms == 0) //-- Rounded horn { Component top = Cylinder( horn_r_top + horn_tol, horn_h_top, 100, false); top.translate(0, 0, horn_h_axis); horn = horn + top; if ( horn_cut < 2*horn_r_top && horn_cut > 0 ) { //-- Create a cube with the dimensions of the cut Component to_be_substracted = Cube( (horn_r_top + horn_tol)- horn_cut + 0.1, 2*(horn_r_top + horn_tol)+0.2, horn_h_top+0.2, false); //-- Center it on Y: to_be_substracted.translate(0, -(horn_r_top + horn_tol)+0.1, 0); //-- Place it on its place (LOL) and substract it: horn = horn - to_be_substracted.translate( horn_cut + 0.1 ,0, horn_h_axis-0.1); horn.relRotate( 0, 0, 90); } } else //-- Horn with arms: { //-- Create a single arm: Component base = Cube( 2*horn_r_axis, horn_arm_shift + 0.001, horn_h_top+0.1); Component upper_cyl = Cylinder( horn_arm_r,horn_h_top+0.1, 100, true); upper_cyl = upper_cyl.translate( 0, horn_arm_dist, 0); Component arm = base & upper_cyl; arm.translate(0, 0, (horn_h_top+0.1) /2); //-- Create the orher arms by rotation: Component arms = arm; for ( int i = 1; i < horn_num_arms; i++) arms = arms + arm.rotatedCopy(0,0, 360/horn_num_arms*i); 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); } |