Human36Model.cc
Go to the documentation of this file.
2 #include "rdl_dynamics/Model.h"
3 
4 using namespace RobotDynamics;
5 using namespace RobotDynamics::Math;
6 
8 {
10 };
11 
12 double SegmentLengths[SegmentNameLast] = {0.1457, 0.4222, 0.4403, 0.1037, 0.2155, 0.2421, 0.2817, 0.2689, 0.0862, 0.2429};
13 
14 double SegmentMass[SegmentNameLast] = {0.8154, 10.3368, 3.1609, 1.001, 16.33, 15.96, 1.9783, 1.1826, 0.4453, 5.0662};
15 
16 double SegmentCOM[SegmentNameLast][3] = {{0., 0., 0.0891}, {0., 0., -0.1729}, {0., 0., -0.1963}, {0.1254, 0., -0.0516}, {0., 0., 0.1185}, {0., 0., 0.1195}, {0., 0., -0.1626}, {0., 0., -0.1230}, {0., 0., -0.0680}, {0., 0., 1.1214}};
17 
18 double SegmentRadiiOfGyration[SegmentNameLast][3] = {{0.0897, 0.0855, 0.0803}, {0.1389, 0.0629, 0.1389}, {0.1123, 0.0454, 0.1096}, {0.0267, 0.0129, 0.0254}, {0.0970, 0.1009, 0.0825}, {0.1273, 0.1172, 0.0807}, {0.0803, 0.0758, 0.0445}, {0.0742, 0.0713, 0.0325}, {0.0541, 0.0442, 0.0346}, {0.0736, 0.0634, 0.0765}};
19 
21 {
22  Matrix3d inertia_C(Matrix3d::Zero());
23  inertia_C(0, 0) = pow(SegmentRadiiOfGyration[segment][0] * SegmentLengths[segment], 2) * SegmentMass[segment];
24  inertia_C(1, 1) = pow(SegmentRadiiOfGyration[segment][1] * SegmentLengths[segment], 2) * SegmentMass[segment];
25  inertia_C(2, 2) = pow(SegmentRadiiOfGyration[segment][2] * SegmentLengths[segment], 2) * SegmentMass[segment];
26 
27  return RobotDynamics::Body(SegmentMass[segment], RobotDynamics::Math::Vector3d(SegmentCOM[segment][0], SegmentCOM[segment][1], SegmentCOM[segment][2]), inertia_C);
28 }
29 
31 {
32  Body pelvis_body = create_body(SegmentPelvis);
33  Body thigh_body = create_body(SegmentThigh);
34  Body shank_body = create_body(SegmentShank);
35  Body foot_body = create_body(SegmentFoot);
36  Body middle_trunk_body = create_body(SegmentMiddleTrunk);
37  Body upper_trunk_body = create_body(SegmentUpperTrunk);
38  Body upperarm_body = create_body(SegmentUpperArm);
39  Body lowerarm_body = create_body(SegmentLowerArm);
40  Body hand_body = create_body(SegmentHand);
41  Body head_body = create_body(SegmentHead);
42 
43  Joint free_flyer(SpatialVector(0., 0., 0., 1., 0., 0.), SpatialVector(0., 0., 0., 0., 1., 0.), SpatialVector(0., 0., 0., 0., 0., 1.), SpatialVector(0., 1., 0., 0., 0., 0.), SpatialVector(0., 0., 1., 0., 0., 0.), SpatialVector(1., 0., 0., 0., 0., 0.));
44 
45  Joint rot_yxz(SpatialVector(0., 1., 0., 0., 0., 0.), SpatialVector(1., 0., 0., 0., 0., 0.), SpatialVector(0., 0., 1., 0., 0., 0.));
46 
47  Joint rot_yz(SpatialVector(0., 1., 0., 0., 0., 0.), SpatialVector(0., 0., 1., 0., 0., 0.));
48 
49  Joint rot_y(SpatialVector(0., 1., 0., 0., 0., 0.));
50 
51  Joint fixed(JointTypeFixed);
52 
53  model->gravity = SpatialVector(0., 0., 0., 0., 0., -9.81);
54 
55  unsigned int pelvis_id = model->addBody(0, Xtrans(Vector3d(0., 0., 0.)), free_flyer, pelvis_body, "pelvis");
56 
57  // right leg
58  model->addBody(pelvis_id, Xtrans(Vector3d(0., -0.0872, 0.)), rot_yxz, thigh_body, "thigh_r");
59  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentThigh])), rot_y, shank_body, "shank_r");
60  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentShank])), rot_yz, foot_body, "foot_r");
61 
62  // left leg
63  model->addBody(pelvis_id, Xtrans(Vector3d(0., 0.0872, 0.)), rot_yxz, thigh_body, "thigh_l");
64  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentThigh])), rot_y, shank_body, "shank_l");
65  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentShank])), rot_yz, foot_body, "foot_l");
66 
67  // trunk
68  model->addBody(pelvis_id, Xtrans(Vector3d(0., 0., SegmentLengths[SegmentPelvis])), rot_yxz, middle_trunk_body, "middletrunk");
69  unsigned int uppertrunk_id = model->appendBody(Xtrans(Vector3d(0., 0., SegmentLengths[SegmentMiddleTrunk])), fixed, upper_trunk_body, "uppertrunk");
70 
71  // right arm
72  model->addBody(uppertrunk_id, Xtrans(Vector3d(0., -0.1900, SegmentLengths[SegmentUpperTrunk])), rot_yxz, upperarm_body, "upperarm_r");
73  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentUpperArm])), rot_y, lowerarm_body, "lowerarm_r");
74  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentLowerArm])), rot_yz, hand_body, "hand_r");
75 
76  // left arm
77  model->addBody(uppertrunk_id, Xtrans(Vector3d(0., 0.1900, SegmentLengths[SegmentUpperTrunk])), rot_yxz, upperarm_body, "upperarm_l");
78  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentUpperArm])), rot_y, lowerarm_body, "lowerarm_l");
79  model->appendBody(Xtrans(Vector3d(0., 0., -SegmentLengths[SegmentLowerArm])), rot_yz, hand_body, "hand_l");
80 
81  // head
82  model->addBody(uppertrunk_id, Xtrans(Vector3d(0., 0.1900, SegmentLengths[SegmentUpperTrunk])), rot_yxz, upperarm_body, "head");
83 }
double SegmentRadiiOfGyration[SegmentNameLast][3]
Definition: Human36Model.cc:18
double SegmentMass[SegmentNameLast]
Definition: Human36Model.cc:14
std::shared_ptr< Model > ModelPtr
double SegmentCOM[SegmentNameLast][3]
Definition: Human36Model.cc:16
SpatialTransform Xtrans(const Vector3d &r)
Body create_body(SegmentName segment)
Definition: Human36Model.cc:20
SegmentName
Definition: Human36Model.cc:7
double SegmentLengths[SegmentNameLast]
Definition: Human36Model.cc:12
void generate_human36model(RobotDynamics::ModelPtr model)
Definition: Human36Model.cc:30


rdl_benchmark
Author(s):
autogenerated on Tue Apr 20 2021 02:25:39