Skip to content

Commit

Permalink
Different leg configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ku3i committed May 29, 2018
1 parent ce884e6 commit 2032d86
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 3 deletions.
1 change: 1 addition & 0 deletions simloidTCP.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<Unit filename="src/robots/biped.h" />
<Unit filename="src/robots/crawler.h" />
<Unit filename="src/robots/fourlegged.h" />
<Unit filename="src/robots/hannah.h" />
<Unit filename="src/robots/karl_sims.h" />
<Unit filename="src/robots/nolegs.h" />
<Unit filename="src/robots/standard.h" />
Expand Down
4 changes: 3 additions & 1 deletion src/build/bioloid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ void Bioloid::create_robot(Robot& robot)

case 30: Robots::Fourlegged::create_wildcat_0 (robot); break;
case 31: Robots::Fourlegged::create_wildcat_1 (robot); break;
case 32: Robots::Hannah ::create_hannah (robot); break;
case 32: Robots::Hannah ::create_hannah_0 (robot); break;
case 33: Robots::Hannah ::create_hannah_1 (robot); break;
case 34: Robots::Hannah ::create_hannah_2 (robot); break;

case 40: Robots::Biped ::create_ostrich (robot); break;

Expand Down
148 changes: 146 additions & 2 deletions src/robots/hannah.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const double weight_leg_lower_kg = 0.200; /**TODO*/


void
create_hannah(Robot& robot)
create_hannah_0(Robot& robot)
{
dsPrint("Creating Hannah <3 \n");
double xpos, ypos, zpos;
Expand All @@ -64,7 +64,7 @@ create_hannah(Robot& robot)

/* legs upper */
zpos = shoulder_z + fz - .5*leg_upper_len;
xpos += 1.5*shoulder_a + 0.5*leg_upper_wx;
xpos += 1.5*shoulder_a + 0.5*leg_upper_wx; /**TODO This is wrong 1.5-> eher 0.75*/

robot.create_box("lflu", +xpos, +ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // left fore leg upper
robot.create_box("rflu", -xpos, +ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // right fore leg upper
Expand Down Expand Up @@ -109,6 +109,150 @@ create_hannah(Robot& robot)

}

/* Alternative configuration with both legs inwards */
void
create_hannah_1(Robot& robot)
{
dsPrint("Creating Hannah <3 \n");
double xpos, ypos, zpos;

/* body */
xpos = .0;
ypos = .0;
zpos = zheight_start;
robot.create_box("body", xpos, ypos, zpos, body_x, body_y, body_z, weight_body_kg, 0, colors::black, true, constants::friction::hi); // body

/* shoulders */
const double shoulder_z = zheight_start + 0.5*body_z - fx;

zpos = shoulder_z;
ypos = -.5*body_y -1.5*shoulder_a;
xpos = 0.5*body_x - fx;

robot.create_box("lfsh", +xpos, +ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // left fore shoulder
robot.create_box("rfsh", -xpos, +ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // right fore shoulder
robot.create_box("lhsh", +xpos, -ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // left hind shoulder
robot.create_box("rhsh", -xpos, -ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // right hind shoulder

/* legs upper */
zpos = shoulder_z + fz - .5*leg_upper_len;
xpos += 1.5*shoulder_a + 0.5*leg_upper_wx;

robot.create_box("lflu", +xpos, +ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // left fore leg upper
robot.create_box("rflu", -xpos, +ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // right fore leg upper
robot.create_box("lhlu", +xpos, -ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // left hind leg upper
robot.create_box("rhlu", -xpos, -ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // right hind leg upper

/* legs lower */
zpos = shoulder_z + fz - leg_upper_len - .5*len_leg_lower;

const double dy = leg_upper_wy/2;
const double D = dy+0.01;
const double K = 0.034;

robot.create_segment("lfll", +xpos, +ypos + dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // left fore leg lower
robot.create_segment("rfll", -xpos, +ypos + dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // right fore leg lower
robot.create_segment("lhll", +xpos, -ypos - dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // left hind leg lower
robot.create_segment("rhll", -xpos, -ypos - dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // right hind leg lower

/* connect by joints */
robot.connect_joint("body", "lfsh", .0, .0, .0, 'y', -90, +90, -1, JointType::normal, "L_shoulder_roll" );
robot.connect_joint("body", "rfsh", .0, .0, .0, 'Y', -90, +90, -1, JointType::symmetric, "R_shoulder_roll" , "L_shoulder_roll" );
robot.connect_joint("body", "lhsh", .0, .0, .0, 'y', -90, +90, -1, JointType::normal, "L_hip_roll" );
robot.connect_joint("body", "rhsh", .0, .0, .0, 'Y', -90, +90, -1, JointType::symmetric, "R_hip_roll" , "L_hip_roll" );


robot.connect_joint("lfsh", "lflu", .0, .0, +.5*leg_upper_len - fz, 'x', -90, +90, -12, JointType::normal, "L_shoulder_pitch" );
robot.connect_joint("rfsh", "rflu", .0, .0, +.5*leg_upper_len - fz, 'x', -90, +90, -12, JointType::symmetric, "R_shoulder_pitch", "L_shoulder_pitch");
robot.connect_joint("lflu", "lfll", .0, -D, +.5*len_leg_lower + K , 'x', 0, +180, +30, JointType::normal, "L_elbow_pitch" );
robot.connect_joint("rflu", "rfll", .0, -D, +.5*len_leg_lower + K , 'x', 0, +180, +30, JointType::symmetric, "R_elbow_pitch" , "L_elbow_pitch" );

robot.connect_joint("lhsh", "lhlu", .0, .0, +.5*leg_upper_len - fz, 'X', -90, +90, -12, JointType::normal, "L_hip_pitch" );
robot.connect_joint("rhsh", "rhlu", .0, .0, +.5*leg_upper_len - fz, 'X', -90, +90, -12, JointType::symmetric, "R_hip_pitch" , "L_hip_pitch" );
robot.connect_joint("lhlu", "lhll", .0, +D, +.5*len_leg_lower + K , 'X', 0, +180, +30, JointType::normal, "L_knee_pitch" );
robot.connect_joint("rhlu", "rhll", .0, +D, +.5*len_leg_lower + K , 'X', 0, +180, +30, JointType::symmetric, "R_knee_pitch" , "L_knee_pitch" );

/* attach sensors */
robot.attach_accel_sensor("body");

/* camera */
robot.set_camera_center_on("body");
robot.setup_camera(Vector3(1.5, -0.5, 0.7), 140, -10, 0);

}

/* Another alternative configuration with both legs outwards */
void
create_hannah_2(Robot& robot)
{
dsPrint("Creating Hannah <3 \n");
double xpos, ypos, zpos;

/* body */
xpos = .0;
ypos = .0;
zpos = zheight_start;
robot.create_box("body", xpos, ypos, zpos, body_x, body_y, body_z, weight_body_kg, 0, colors::black, true, constants::friction::hi); // body

/* shoulders */
const double shoulder_z = zheight_start + 0.5*body_z - fx;

zpos = shoulder_z;
ypos = -.5*body_y -1.5*shoulder_a;
xpos = 0.5*body_x - fx;

robot.create_box("lfsh", +xpos, +ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // left fore shoulder
robot.create_box("rfsh", -xpos, +ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // right fore shoulder
robot.create_box("lhsh", +xpos, -ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // left hind shoulder
robot.create_box("rhsh", -xpos, -ypos, zpos, shoulder_a, shoulder_a, shoulder_a, weight_shoulder_kg, 0, colors::black, true, constants::friction::lo); // right hind shoulder

/* legs upper */
zpos = shoulder_z + fz - .5*leg_upper_len;
xpos += 1.5*shoulder_a + 0.5*leg_upper_wx;

robot.create_box("lflu", +xpos, +ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // left fore leg upper
robot.create_box("rflu", -xpos, +ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // right fore leg upper
robot.create_box("lhlu", +xpos, -ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // left hind leg upper
robot.create_box("rhlu", -xpos, -ypos, zpos, leg_upper_wx, leg_upper_wy, leg_upper_len, weight_leg_upper_kg, 0, colors::white, true, constants::friction::hi); // right hind leg upper

/* legs lower */
zpos = shoulder_z + fz - leg_upper_len - .5*len_leg_lower;

const double dy = leg_upper_wy/2;
const double D = dy+0.01;
const double K = 0.034;

robot.create_segment("lfll", +xpos, +ypos - dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // left fore leg lower
robot.create_segment("rfll", -xpos, +ypos - dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // right fore leg lower
robot.create_segment("lhll", +xpos, -ypos + dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // left hind leg lower
robot.create_segment("rhll", -xpos, -ypos + dy, zpos, 3, len_leg_lower, rad_leg_lower, weight_leg_lower_kg, 0, colors::black, true, constants::friction::sticky); // right hind leg lower

/* connect by joints */
robot.connect_joint("body", "lfsh", .0, .0, .0, 'y', -90, +90, -1, JointType::normal, "L_shoulder_roll" );
robot.connect_joint("body", "rfsh", .0, .0, .0, 'Y', -90, +90, -1, JointType::symmetric, "R_shoulder_roll" , "L_shoulder_roll" );
robot.connect_joint("body", "lhsh", .0, .0, .0, 'y', -90, +90, -1, JointType::normal, "L_hip_roll" );
robot.connect_joint("body", "rhsh", .0, .0, .0, 'Y', -90, +90, -1, JointType::symmetric, "R_hip_roll" , "L_hip_roll" );


robot.connect_joint("lfsh", "lflu", .0, .0, +.5*leg_upper_len - fz, 'X', -90, +90, -15, JointType::normal, "L_shoulder_pitch" );
robot.connect_joint("rfsh", "rflu", .0, .0, +.5*leg_upper_len - fz, 'X', -90, +90, -15, JointType::symmetric, "R_shoulder_pitch", "L_shoulder_pitch");
robot.connect_joint("lflu", "lfll", .0, +D, +.5*len_leg_lower + K , 'X', 0, +180, +30, JointType::normal, "L_elbow_pitch" );
robot.connect_joint("rflu", "rfll", .0, +D, +.5*len_leg_lower + K , 'X', 0, +180, +30, JointType::symmetric, "R_elbow_pitch" , "L_elbow_pitch" );

robot.connect_joint("lhsh", "lhlu", .0, .0, +.5*leg_upper_len - fz, 'x', -90, +90, -15, JointType::normal, "L_hip_pitch" );
robot.connect_joint("rhsh", "rhlu", .0, .0, +.5*leg_upper_len - fz, 'x', -90, +90, -15, JointType::symmetric, "R_hip_pitch" , "L_hip_pitch" );
robot.connect_joint("lhlu", "lhll", .0, -D, +.5*len_leg_lower + K , 'x', 0, +180, +30, JointType::normal, "L_knee_pitch" );
robot.connect_joint("rhlu", "rhll", .0, -D, +.5*len_leg_lower + K , 'x', 0, +180, +30, JointType::symmetric, "R_knee_pitch" , "L_knee_pitch" );

/* attach sensors */
robot.attach_accel_sensor("body");

/* camera */
robot.set_camera_center_on("body");
robot.setup_camera(Vector3(1.5, -0.5, 0.7), 140, -10, 0);

}


void
create_hannah_leg(Robot& robot)
Expand Down

0 comments on commit 2032d86

Please sign in to comment.