50 template <
int t_features>
73 WHEEL_FRONT_RIGHT = 1,
91 ids.push_back(
"Tibia");
104 ids.push_back(
"Head");
105 ids.push_back(
"Hip");
106 ids.push_back(
"LBicep");
107 ids.push_back(
"LElbow");
122 ids.push_back(
"LForeArm");
123 ids.push_back(
"LShoulder");
128 ids.push_back(
"Neck");
129 ids.push_back(
"Pelvis");
130 ids.push_back(
"RBicep");
131 ids.push_back(
"RElbow");
146 ids.push_back(
"RForeArm");
147 ids.push_back(
"RShoulder");
153 ids.push_back(
"l_wrist");
155 ids.push_back(
"r_wrist");
156 ids.push_back(
"torso");
167 id =
"base_footprint";
178 id =
"base_footprint";
193 etools::Vector3 front_left_wheel_rpy(0, 0, 1.07519348146676);
194 etools::Vector3 front_right_wheel_rpy(0, 0, -1.07519348146676);
198 etools::Vector3 front_left_wheel_position(0.09, 0.155, 0);
199 etools::Vector3 front_right_wheel_position(0.09, -0.155, 0);
200 etools::Vector3 back_wheel_position(-0.17, 0, 0);
202 etools::Vector3 z_axis(0, 0, 1);
204 double wheel_radius = 0.07;
222 front_left_wheel_transform << front_left_wheel_tangent.segment(0, 2).transpose(),
223 -front_left_wheel_tangent.transpose()*(front_left_wheel_position.cross(z_axis));
225 front_right_wheel_transform << front_right_wheel_tangent.segment(0, 2).transpose(),
226 -front_right_wheel_tangent.transpose()*(front_right_wheel_position.cross(z_axis));
228 back_wheel_transform << back_wheel_tangent.segment(0, 2).transpose(),
229 -back_wheel_tangent.transpose()*(back_wheel_position.cross(z_axis));
236 result << front_left_wheel_transform / wheel_radius,
237 front_right_wheel_transform / wheel_radius,
238 back_wheel_transform / wheel_radius;
252 template <
int t_features_out,
int t_features_in>
255 const int out_index_offset = ModelDescription<t_features_out>::ROOT_DOF_NUMBER;
256 const int in_index_offset = ModelDescription<t_features_in>::ROOT_DOF_NUMBER;
258 Eigen::MatrixXd reordered_matrix;
260 reordered_matrix.resize(matrix.rows(), ModelDescription<t_features_out>::DOF_NUMBER);
263 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::KneePitch ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::KneePitch );
264 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::HipPitch ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::HipPitch );
265 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::HipRoll ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::HipRoll );
266 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::HeadYaw ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::HeadYaw );
267 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::HeadPitch ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::HeadPitch );
268 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::LShoulderPitch) = matrix.col(in_index_offset + ModelDescription<t_features_in>::LShoulderPitch);
269 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::LShoulderRoll ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::LShoulderRoll );
270 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::LElbowYaw ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::LElbowYaw );
271 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::LElbowRoll ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::LElbowRoll );
272 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::LWristYaw ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::LWristYaw );
273 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::RShoulderPitch) = matrix.col(in_index_offset + ModelDescription<t_features_in>::RShoulderPitch);
274 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::RShoulderRoll ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::RShoulderRoll );
275 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::RElbowYaw ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::RElbowYaw );
276 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::RElbowRoll ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::RElbowRoll );
277 reordered_matrix.col(out_index_offset + ModelDescription<t_features_out>::RWristYaw ) = matrix.col(in_index_offset + ModelDescription<t_features_in>::RWristYaw );
279 matrix = reordered_matrix;
292 max_velocities << 6.28319, 6.28319, 6.28319;
308 template <
int t_features>
312 min_bounds(ModelDescription<t_features>::KneePitch ) = -0.51487200000000000;
313 min_bounds(ModelDescription<t_features>::HipPitch ) = -1.03847000000000000;
314 min_bounds(ModelDescription<t_features>::HipRoll ) = -0.51487200000000000;
315 min_bounds(ModelDescription<t_features>::HeadYaw ) = -2.08566999999999991;
316 min_bounds(ModelDescription<t_features>::HeadPitch ) = -0.70685799999999999;
317 min_bounds(ModelDescription<t_features>::LShoulderPitch) = -2.08566999999999991;
318 min_bounds(ModelDescription<t_features>::LShoulderRoll ) = 0.00872665000000000;
319 min_bounds(ModelDescription<t_features>::LElbowYaw ) = -2.08566999999999991;
320 min_bounds(ModelDescription<t_features>::LElbowRoll ) = -1.56207000000000007;
321 min_bounds(ModelDescription<t_features>::LWristYaw ) = -1.82387000000000010;
322 min_bounds(ModelDescription<t_features>::RShoulderPitch) = -2.08566999999999991;
323 min_bounds(ModelDescription<t_features>::RShoulderRoll ) = -1.56207000000000007;
324 min_bounds(ModelDescription<t_features>::RElbowYaw ) = -2.08566999999999991;
325 min_bounds(ModelDescription<t_features>::RElbowRoll ) = 0.00872665000000000;
326 min_bounds(ModelDescription<t_features>::RWristYaw ) = -1.82387000000000010;
328 max_bounds(ModelDescription<t_features>::KneePitch ) = 0.51487200000000000;
329 max_bounds(ModelDescription<t_features>::HipPitch ) = 1.03847000000000000;
330 max_bounds(ModelDescription<t_features>::HipRoll ) = 0.51487200000000000;
331 max_bounds(ModelDescription<t_features>::HeadYaw ) = 2.08566999999999991;
332 max_bounds(ModelDescription<t_features>::HeadPitch ) = 0.63704499999999997;
333 max_bounds(ModelDescription<t_features>::LShoulderPitch) = 2.08566999999999991;
334 max_bounds(ModelDescription<t_features>::LShoulderRoll ) = 1.56207000000000007;
335 max_bounds(ModelDescription<t_features>::LElbowYaw ) = 2.08566999999999991;
336 max_bounds(ModelDescription<t_features>::LElbowRoll ) = -0.00872665000000000;
337 max_bounds(ModelDescription<t_features>::LWristYaw ) = 1.82387000000000010;
338 max_bounds(ModelDescription<t_features>::RShoulderPitch) = 2.08566999999999991;
339 max_bounds(ModelDescription<t_features>::RShoulderRoll ) = -0.00872665000000000;
340 max_bounds(ModelDescription<t_features>::RElbowYaw ) = 2.08566999999999991;
341 max_bounds(ModelDescription<t_features>::RElbowRoll ) = 1.56207000000000007;
342 max_bounds(ModelDescription<t_features>::RWristYaw ) = 1.82387000000000010;
355 template <
int t_features>
358 joint_vel_bounds(ModelDescription<t_features>::KneePitch ) = 2.93276;
359 joint_vel_bounds(ModelDescription<t_features>::HipPitch ) = 2.93276;
360 joint_vel_bounds(ModelDescription<t_features>::HipRoll ) = 2.27032;
361 joint_vel_bounds(ModelDescription<t_features>::HeadYaw ) = 7.33998;
362 joint_vel_bounds(ModelDescription<t_features>::HeadPitch ) = 9.22756;
363 joint_vel_bounds(ModelDescription<t_features>::LShoulderPitch) = 7.33998;
364 joint_vel_bounds(ModelDescription<t_features>::LShoulderRoll ) = 9.22756;
365 joint_vel_bounds(ModelDescription<t_features>::LElbowYaw ) = 7.33998;
366 joint_vel_bounds(ModelDescription<t_features>::LElbowRoll ) = 9.22756;
367 joint_vel_bounds(ModelDescription<t_features>::LWristYaw ) = 17.3835;
368 joint_vel_bounds(ModelDescription<t_features>::RShoulderPitch) = 7.33998;
369 joint_vel_bounds(ModelDescription<t_features>::RShoulderRoll ) = 9.22756;
370 joint_vel_bounds(ModelDescription<t_features>::RElbowYaw ) = 7.33998;
371 joint_vel_bounds(ModelDescription<t_features>::RElbowRoll ) = 9.22756;
372 joint_vel_bounds(ModelDescription<t_features>::RWristYaw ) = 17.3835;
383 template <
int t_features>
407 joint_angles(ModelDescription<t_features>::KneePitch ) = -0.1975011835036236;
408 joint_angles(ModelDescription<t_features>::HipPitch ) = 0.4160023626190753;
409 joint_angles(ModelDescription<t_features>::HipRoll ) = 0.0;
411 joint_angles(ModelDescription<t_features>::HeadYaw ) = 0.0;
412 joint_angles(ModelDescription<t_features>::HeadPitch ) = 0.06850114982656237;
414 joint_angles(ModelDescription<t_features>::LShoulderPitch) = 1.639454123287812;
415 joint_angles(ModelDescription<t_features>::LShoulderRoll ) = 0.12;
416 joint_angles(ModelDescription<t_features>::LElbowYaw ) = -1.2217007;
417 joint_angles(ModelDescription<t_features>::LElbowRoll ) = -0.52345699;
418 joint_angles(ModelDescription<t_features>::LWristYaw ) = 0.0;
420 joint_angles(ModelDescription<t_features>::RShoulderPitch) = 1.639454123287804;
421 joint_angles(ModelDescription<t_features>::RShoulderRoll ) = -0.12;
422 joint_angles(ModelDescription<t_features>::RElbowYaw ) = 1.2217007;
423 joint_angles(ModelDescription<t_features>::RElbowRoll ) = 0.52345699;
424 joint_angles(ModelDescription<t_features>::RWristYaw ) = 0.0;
429 #define HUMOTO_PARENT_CLASS_SHORTHAND ModelDescriptionBase<ModelFeatures::FIXED_WHEELS> 447 ROOT_TRANSLATION_X = 0,
448 ROOT_TRANSLATION_Y = 1,
449 ROOT_TRANSLATION_Z = 2,
451 ROOT_ORIENTATION_ROLL = 3,
452 ROOT_ORIENTATION_PITCH = 4,
453 ROOT_ORIENTATION_YAW = 5,
483 JOINTS_DOF_NUMBER = 15,
485 DOF_NUMBER = ROOT_DOF_NUMBER + JOINTS_DOF_NUMBER
498 etools::Vector6 & root_pose)
500 root_pose.segment(ROOT_TRANSLATION_X, 3) << 0.0135554392293566, 0.0, 0.819715156461154;
501 root_pose.segment(ROOT_ORIENTATION_ROLL, 3) << 0.0, 0.05, 0.0;
503 HUMOTO_PARENT_CLASS_SHORTHAND::getDefaultJointAngles<features_>(joint_angles);
514 JointAnglesVector & max_bounds)
516 HUMOTO_PARENT_CLASS_SHORTHAND::getJointPositionBounds<features_>(min_bounds, max_bounds);
527 HUMOTO_PARENT_CLASS_SHORTHAND::getJointVelocityBounds<features_>(joint_vel_bounds);
538 HUMOTO_PARENT_CLASS_SHORTHAND::getDefaultJointAngles<features_>(joint_angles);
550 const etools::Vector3 & position)
552 root_pose.segment(ROOT_TRANSLATION_X, 3) = position;
563 const etools::Vector3 & rpy)
565 root_pose.segment(ROOT_ORIENTATION_ROLL, 3) =
579 const etools::Vector6 & root_pose)
581 position = root_pose.segment(ROOT_TRANSLATION_X, 3);
592 const etools::Vector6 & root_pose)
607 etools::Vector3 & position)
609 parent_link_string_id =
"torso";
610 position << 0.0, 0.0, 0.0;
632 ROOT_TRANSLATION_X = 0,
633 ROOT_TRANSLATION_Y = 1,
634 ROOT_TRANSLATION_Z = 2,
636 ROOT_ORIENTATION_ROLL = 3,
637 ROOT_ORIENTATION_PITCH = 4,
638 ROOT_ORIENTATION_YAW = 5,
668 JOINTS_DOF_NUMBER = 15,
670 DOF_NUMBER = ROOT_DOF_NUMBER + JOINTS_DOF_NUMBER
684 etools::Vector6 & root_pose)
687 HUMOTO_PARENT_CLASS_SHORTHAND::getDefaultJointAngles<features_>(joint_angles);
698 JointAnglesVector & max_bounds)
700 HUMOTO_PARENT_CLASS_SHORTHAND::getJointPositionBounds<features_>(min_bounds, max_bounds);
711 HUMOTO_PARENT_CLASS_SHORTHAND::getJointVelocityBounds<features_>(joint_vel_bounds);
722 HUMOTO_PARENT_CLASS_SHORTHAND::getDefaultJointAngles<features_>(joint_angles);
733 const etools::Vector3 & position)
735 root_pose.segment(ROOT_TRANSLATION_X, 3) = position;
746 const etools::Vector3 & rpy)
748 root_pose.segment(ROOT_ORIENTATION_ROLL, 3) =
762 const etools::Vector6 & root_pose)
764 position = root_pose.segment(ROOT_TRANSLATION_X, 3);
775 etools::Vector3 & position)
777 parent_link_string_id =
"torso";
778 position << -2e-05, 0, 0.139;
789 const etools::Vector6 & root_pose)
815 ROOT_TRANSLATION_X = 0,
816 ROOT_TRANSLATION_Y = 1,
817 ROOT_ORIENTATION_YAW = 2,
847 JOINTS_DOF_NUMBER = 15,
849 DOF_NUMBER = ROOT_DOF_NUMBER + JOINTS_DOF_NUMBER
863 etools::Vector3 & root_pose)
865 root_pose.segment(ROOT_TRANSLATION_X, 2) << 0.0, 0.0;
866 root_pose(ROOT_ORIENTATION_YAW) = 0.0;
868 HUMOTO_PARENT_CLASS_SHORTHAND::getDefaultJointAngles<features_>(joint_angles);
879 JointAnglesVector & max_bounds)
881 HUMOTO_PARENT_CLASS_SHORTHAND::getJointPositionBounds<features_>(min_bounds, max_bounds);
892 HUMOTO_PARENT_CLASS_SHORTHAND::getJointVelocityBounds<features_>(joint_vel_bounds);
903 HUMOTO_PARENT_CLASS_SHORTHAND::getDefaultJointAngles<features_>(joint_angles);
914 const etools::Vector3 & position)
917 "Translation along the Z axis is not supported.");
918 root_pose(ROOT_TRANSLATION_X) = position.x();
919 root_pose(ROOT_TRANSLATION_Y) = position.y();
930 const etools::Vector3 & rpy)
933 "Only rotation about the Z axis is supported.");
934 root_pose(ROOT_ORIENTATION_YAW) = rpy.z();
945 const etools::Vector3 & root_pose)
947 position.x() = root_pose(ROOT_TRANSLATION_X);
948 position.y() = root_pose(ROOT_TRANSLATION_Y);
960 const etools::Vector3 & root_pose)
962 rpy << 0.0, 0.0, root_pose(ROOT_ORIENTATION_YAW);
973 etools::Vector3 & position)
975 parent_link_string_id =
"torso";
976 position << -2e-05, 0, 0.139;
979 #undef HUMOTO_PARENT_CLASS_SHORTHAND static void getBodyLinksStringIds(std::vector< std::string > &ids)
Get string ids of the links comprising the upper body.
static void reorderJointsColumns(Eigen::MatrixXd &matrix)
Use joint order to reorder columns of the given matrix.
JointsDoFIds
Ids of joints DoF.
static void getDefaultGeneralizedCoordinates(JointAnglesVector &joint_angles, etools::Vector6 &root_pose)
Get default generalized coordinates.
static void getRootOrientation(etools::Vector3 &rpy, const etools::Vector6 &root_pose)
Get root orientation given RPY Euler angles.
JointsDoFIds
Ids of joints DoF.
static void getJointVelocityBounds(EIGENTOOLS_CONSTANT_SIZE_VECTOR(ModelDescription< t_features >::JOINTS_DOF_NUMBER) &joint_vel_bounds)
Returns bounds on joint velocities.
#define HUMOTO_ASSERT(condition, message)
static void getRootOrientation(etools::Vector3 &rpy, const etools::Vector3 &root_pose)
Get root orientation given RPY Euler angles.
static void getDefaultGeneralizedCoordinates(JointAnglesVector &joint_angles, etools::Vector3 &root_pose)
Get default generalized coordinates.
static void getRootPosition(etools::Vector3 &position, const etools::Vector3 &root_pose)
Get root position.
#define HUMOTO_PARENT_CLASS_SHORTHAND
etools::Vector3 convertEulerAngles(const etools::Vector3 &euler_angles, const EulerAngles::Type euler_angles_type_from, const EulerAngles::Type euler_angles_type_to)
Convert Euler angles to a different set ofEuler angles.
static void getBaseLinksStringIds(std::vector< std::string > &ids)
Get string ids of the bodies comprising the base.
static etools::Matrix3 getRootMotionToWheelsTransform()
Returns matrix which maps velocities of the wheels to translational and rotational motion of the base...
static void getTorsoRootLocation(std::string &parent_link_string_id, etools::Vector3 &position)
Location of the torso root.
RootDoFIds
Ids of root DoF.
static void setRootPosition(etools::Vector6 &root_pose, const etools::Vector3 &position)
Set root position to the position given vector.
static void setRootPosition(etools::Vector3 &root_pose, const etools::Vector3 &position)
Set root position to the position given vector.
static void getJointVelocityBounds(JointAnglesVector &joint_vel_bounds)
Returns bounds on joint velocities.
static void getDefaultJointAngles(JointAnglesVector &joint_angles)
Get default joint angles (with zero offset)
static void getJointVelocityBounds(JointAnglesVector &joint_vel_bounds)
Returns bounds on joint velocities.
static void getTorsoRootLocation(std::string &parent_link_string_id, etools::Vector3 &position)
Location of the torso root.
static void getJointPositionBounds(JointAnglesVector &min_bounds, JointAnglesVector &max_bounds)
Returns joint position bounds.
static void getBasePositionLinkStringId(std::string &id)
Get id of the body which is used to control position of the base.
static void setRootOrientation(etools::Vector6 &root_pose, const etools::Vector3 &rpy)
Set root orientation given RPY Euler angles.
class HUMOTO_LOCAL ModelDescription
Specific model description classes.
The root namespace of HuMoTo.
static void getJointPositionBounds(JointAnglesVector &min_bounds, JointAnglesVector &max_bounds)
Returns joint position bounds.
static void getDefaultJointAngles(EIGENTOOLS_CONSTANT_SIZE_VECTOR(ModelDescription< t_features >::JOINTS_DOF_NUMBER) &joint_angles)
Sets joint angles in the given vector to their default values.
static void setRootPosition(etools::Vector6 &root_pose, const etools::Vector3 &position)
Set root position to the position given vector.
static void getJointPositionBounds(JointAnglesVector &min_bounds, JointAnglesVector &max_bounds)
Returns joint position bounds.
RootDoFIds
Ids of root DoF.
static void setRootOrientation(etools::Vector3 &root_pose, const etools::Vector3 &rpy)
Set root orientation given RPY Euler angles.
static void getDefaultJointAngles(JointAnglesVector &joint_angles)
Get default joint angles (with zero offset)
static void setRootOrientation(etools::Vector6 &root_pose, const etools::Vector3 &rpy)
Set root orientation given RPY Euler angles.
static void getDefaultJointAngles(JointAnglesVector &joint_angles)
Get default joint angles (with zero offset)
static void getDefaultGeneralizedCoordinates(JointAnglesVector &joint_angles, etools::Vector6 &root_pose)
Get default generalized coordinates.
static void getRootPosition(etools::Vector3 &position, const etools::Vector6 &root_pose)
Get root position.
static void getBaseOrientationLinkStringId(std::string &id)
Get id of the body which is used to control orientation of the base.
static void getTorsoRootLocation(std::string &parent_link_string_id, etools::Vector3 &position)
Location of the torso root.
class HUMOTO_LOCAL ModelDescriptionBase
Base model description class.
static void getMaxWheelVelocities(etools::Vector3 &max_velocities)
Returns maximal velocites, which can be executed by the wheels.
const double g_pi
PI constant.
Model features are used to define different versions of the model.
static void getRootPosition(etools::Vector3 &position, const etools::Vector6 &root_pose)
Get root position.
static void getJointVelocityBounds(JointAnglesVector &joint_vel_bounds)
Returns bounds on joint velocities.
JointsDoFIds
Ids of joints DoF.
RootDoFIds
Ids of root DoF.
static void getRootOrientation(etools::Vector3 &rpy, const etools::Vector6 &root_pose)
Get root orientation given RPY Euler angles.
static void getJointPositionBounds(EIGENTOOLS_CONSTANT_SIZE_VECTOR(ModelDescription< t_features >::JOINTS_DOF_NUMBER) &min_bounds, EIGENTOOLS_CONSTANT_SIZE_VECTOR(ModelDescription< t_features >::JOINTS_DOF_NUMBER) &max_bounds)
Returns joint position bounds.
etools::Matrix3 convertEulerAnglesToMatrix(const etools::Vector3 &euler_angles, const EulerAngles::Type euler_angles_type)
Convert rotation matrix to Euler angles.