1 #ifndef __RDL_HUMAN36_FIXTURE_H__ 2 #define __RDL_HUMAN36_FIXTURE_H__ 7 #include <gtest/gtest.h> 185 Matrix3d inertia_C(Matrix3d::Zero());
186 inertia_C(0, 0) = pow(SegmentRadiiOfGyration[segment][0] * SegmentLengths[segment], 2) * SegmentMass[segment];
187 inertia_C(1, 1) = pow(SegmentRadiiOfGyration[segment][1] * SegmentLengths[segment], 2) * SegmentMass[segment];
188 inertia_C(2, 2) = pow(SegmentRadiiOfGyration[segment][2] * SegmentLengths[segment], 2) * SegmentMass[segment];
210 Matrix3d zero_matrix(Matrix3d::Zero(3, 3));
214 Joint free_flyer(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
215 SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.),
SpatialVector(0., 0., 1., 0., 0., 0.));
217 Joint rot_yxz_emulated(
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.),
SpatialVector(0., 0., 1., 0., 0., 0.));
223 Joint rot_yz(
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(0., 0., 1., 0., 0., 0.));
242 model_emulated->
addBody(body_id_emulated[BodyPelvis],
Xtrans(
Vector3d(0., 0.0872, 0.)), rot_yxz_emulated, thigh_body,
"thigh_l");
248 rot_yxz_emulated, middle_trunk_body,
"middletrunk");
254 rot_yxz_emulated, upperarm_body,
"upperarm_r");
260 rot_yxz_emulated, upperarm_body,
"upperarm_l");
265 body_id_emulated[
BodyHead] = model_emulated->
addBody(body_id_emulated[BodyUpperTrunk],
Xtrans(
Vector3d(0., 0.1900, SegmentLengths[SegmentUpperTrunk])),
266 rot_yxz_emulated, upperarm_body,
"head");
271 unsigned int pelvis_trans = model_3dof->
addBody(0,
Xtrans(
Vector3d(0., 0., 0.)), trans_xyz, null_body,
"pelvis_trans_xyz");
288 model_3dof->
addBody(body_id_3dof[BodyPelvis],
Xtrans(
Vector3d(0., 0., SegmentLengths[SegmentPelvis])), rot_yxz_3dof, middle_trunk_body,
"middletrunk");
293 rot_yxz_3dof, upperarm_body,
"upperarm_r");
299 model_3dof->
addBody(body_id_3dof[BodyUpperTrunk],
Xtrans(
Vector3d(0., 0.1900, SegmentLengths[SegmentUpperTrunk])), rot_yxz_3dof, upperarm_body,
"upperarm_l");
305 model_3dof->
addBody(body_id_3dof[BodyUpperTrunk],
Xtrans(
Vector3d(0., 0.1900, SegmentLengths[SegmentUpperTrunk])), rot_yxz_3dof, upperarm_body,
"head");
313 unsigned int foot_r_emulated = model_emulated->
GetBodyId(
"foot_r");
314 unsigned int foot_l_emulated = model_emulated->
GetBodyId(
"foot_l");
315 unsigned int hand_r_emulated = model_emulated->
GetBodyId(
"hand_r");
316 unsigned int hand_l_emulated = model_emulated->
GetBodyId(
"hand_l");
319 constraints_1B1C_emulated.
bind(*model_emulated);
325 constraints_1B4C_emulated.
bind(*model_emulated);
346 constraints_4B4C_emulated.
bind(*model);
348 unsigned int foot_r_3dof = model_3dof->
GetBodyId(
"foot_r");
349 unsigned int foot_l_3dof = model_3dof->
GetBodyId(
"foot_l");
350 unsigned int hand_r_3dof = model_3dof->
GetBodyId(
"hand_r");
351 unsigned int hand_l_3dof = model_3dof->
GetBodyId(
"hand_l");
354 constraints_1B1C_3dof.
bind(*model_3dof);
360 constraints_1B4C_3dof.
bind(*model_3dof);
381 constraints_4B4C_3dof.
bind(*model_3dof);
386 for (
int i = 0; i < q.size(); i++)
388 q[i] = 0.4 * M_PI *
static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
389 qdot[i] = 0.5 * M_PI *
static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
390 tau[i] = 0.5 * M_PI *
static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
391 qddot[i] = 0.5 * M_PI *
static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
394 qddot_emulated =
qddot;
415 q = VectorNd::Zero(model_emulated->
q_size);
416 qdot = VectorNd::Zero(model_emulated->
qdot_size);
417 qddot = VectorNd::Zero(model_emulated->
qdot_size);
418 tau = VectorNd::Zero(model_emulated->
qdot_size);
420 qddot_emulated = VectorNd::Zero(model_emulated->
qdot_size);
421 qddot_3dof = VectorNd::Zero(model_emulated->
qdot_size);
Describes all properties of a single body.
RobotDynamics::Model * model_3dof
RobotDynamics::Math::VectorNd qdot
unsigned int body_id_3dof[BodyNameLast]
RobotDynamics::ConstraintSet constraints_4B4C_3dof
double SegmentLengths[SegmentNameLast]
void initConstraintSets()
RobotDynamics::ConstraintSet constraints_4B4C_emulated
SpatialTransform Xtrans(const Vector3d &r)
Get pure translation transform.
Fixed joint which causes the inertial properties to be merged with.
unsigned int addConstraint(unsigned int body_id, const Math::Vector3d &body_point, const Math::Vector3d &world_normal, const char *constraint_name=NULL, double normal_acceleration=0.)
Adds a constraint to the constraint set.
bool checkModelZeroVectorsAndMatrices(RobotDynamics::Model &model)
Math::MotionVector gravity
the cartesian vector of the gravity
unsigned int appendBody(const Math::SpatialTransform &joint_frame, const Joint &joint, const Body &body, std::string body_name="")
Adds a Body to the model such that the previously added Body is the Parent.
RobotDynamics::Math::VectorNd tau
double SegmentRadiiOfGyration[SegmentNameLast][3]
unsigned int addBody(const unsigned int parent_id, const Math::SpatialTransform &joint_frame, const Joint &joint, const Body &body, std::string body_name="")
Connects a given body to the model.
RobotDynamics::Body create_body(SegmentName segment)
unsigned int q_size
The size of the -vector. For models without spherical joints the value is the same as Model::dof_coun...
Structure that contains both constraint information and workspace memory.
Describes a joint relative to the predecessor body.
unsigned int GetBodyId(const char *body_name) const
Returns the id of a body that was passed to addBody()
RobotDynamics::ConstraintSet constraints_1B4C_3dof
unsigned int body_id_emulated[BodyNameLast]
double SegmentMass[SegmentNameLast]
Contains all information about the rigid body model.
bool bind(const Model &model)
Initializes and allocates memory for the constraint set.
Math types such as vectors and matrices and utility functions.
RobotDynamics::ConstraintSet constraints_1B4C_emulated
RobotDynamics::ConstraintSet constraints_1B1C_3dof
RobotDynamics::Math::VectorNd qddot_3dof
RobotDynamics::Model * model
RobotDynamics::ConstraintSet constraints_1B1C_emulated
RobotDynamics::Math::VectorNd qddot
RobotDynamics::Math::VectorNd qddot_emulated
RobotDynamics::Math::VectorNd q
Namespace for all structures of the RobotDynamics library.
unsigned int qdot_size
The size of the.
double SegmentCOM[SegmentNameLast][3]
RobotDynamics::Model * model_emulated
3 DoF joint that uses Euler YXZ convention (faster than emulated