6 #ifndef __RDL_JOINT_H__
7 #define __RDL_JOINT_H__
309 throw RdlException(
"Error: Invalid use of Joint constructor Joint(JointType type). Only allowed when type != JointTypeCustom");
313 throw RdlException(
"Error: Invalid use of Joint constructor Joint(JointType type).");
324 for (
unsigned int i = 0; i <
mDoFCount; ++i)
331 throw RdlException(
"Error: Invalid use of Joint constructor Joint(JointType type, int degreesOfFreedom). Only allowed when type == JointTypeCustom.");
339 for (
unsigned int i = 0; i <
mDoFCount; i++)
359 for (
unsigned int i = 0; i <
mDoFCount; i++)
403 mJointAxes[0].
set(joint_axis[0], joint_axis[1], joint_axis[2], 0., 0., 0.);
408 assert(joint_axis.squaredNorm() == 1.);
410 mJointAxes[0].
set(0., 0., 0., joint_axis[0], joint_axis[1], joint_axis[2]);
594 if (fabs(axis.norm() - 1.0) > 1.0e-8)
596 std::cerr <<
"Warning: joint axis is not unit!" << std::endl;
599 bool axis_rotational =
false;
600 bool axis_translational =
false;
605 if (fabs(translation.norm()) < 1.0e-8)
607 axis_rotational =
true;
610 if (fabs(rotation.norm()) < 1.0e-8)
612 axis_translational =
true;
615 return axis_rotational || axis_translational;
Definition: rdl_eigenmath.hpp:187
EIGEN_STRONG_INLINE void set(const double &v0, const double &v1, const double &v2, const double &v3, const double &v4, const double &v5)
Definition: rdl_eigenmath.hpp:223
Definition: rdl_eigenmath.hpp:54
A custom exception.
Definition: RdlExceptions.hpp:18
Eigen::VectorXd VectorNd
Definition: rdl_eigenmath.hpp:20
Eigen::MatrixXd MatrixNd
Definition: rdl_eigenmath.hpp:21
Namespace for all structures of the RobotDynamics library.
Definition: examples.hpp:19
Math::SpatialTransform jcalc_XJ(Model &model, unsigned int joint_id, const Math::VectorNd &q)
Definition: Joint.cpp:212
void jcalc(Model &model, unsigned int joint_id, const VectorNd &q, const VectorNd &qdot)
Computes all variables for a joint model and updates the body frame as well as the body's center of m...
Definition: Joint.cpp:17
JointType
General types of joints.
Definition: Joint.hpp:182
@ JointTypeSpherical
3 DoF joint using Quaternions for joint positional variables and
Definition: Joint.hpp:189
@ JointTypeRevoluteX
Definition: Joint.hpp:186
@ JointTypeCustom
User defined joints of varying size.
Definition: Joint.hpp:207
@ JointTypeFixed
Fixed joint which causes the inertial properties to be merged with.
Definition: Joint.hpp:199
@ JointTypeEulerXYZ
3 DoF joint that uses Euler XYZ convention (faster than emulated
Definition: Joint.hpp:193
@ JointType4DoF
Emulated 4 DoF joint.
Definition: Joint.hpp:204
@ JointTypeRevoluteY
Definition: Joint.hpp:187
@ JointTypeRevoluteZ
Definition: Joint.hpp:188
@ JointTypeTranslationXYZ
Definition: Joint.hpp:197
@ JointType6DoF
Emulated 6 DoF joint.
Definition: Joint.hpp:206
@ JointTypeUndefined
Definition: Joint.hpp:183
@ JointTypeEulerYXZ
3 DoF joint that uses Euler YXZ convention (faster than emulated
Definition: Joint.hpp:195
@ JointTypeEulerZYX
3 DoF joint that uses Euler ZYX convention (faster than emulated
Definition: Joint.hpp:191
@ JointType2DoF
Emulated 2 DoF joint.
Definition: Joint.hpp:202
@ JointType5DoF
Emulated 5 DoF joint.
Definition: Joint.hpp:205
@ JointTypeRevolute
Definition: Joint.hpp:184
@ JointType1DoF
Definition: Joint.hpp:201
@ JointTypePrismatic
Definition: Joint.hpp:185
@ JointType3DoF
Emulated 3 DoF joint.
Definition: Joint.hpp:203
@ JointTypeFloatingBase
A 6-DoF joint for floating-base (or freeflyer) systems.
Definition: Joint.hpp:198
void jcalc_X_lambda_S(Model &model, unsigned int joint_id, const VectorNd &q)
Definition: Joint.cpp:242
CustomJoint is a struct used to create a joint with user defined parameters. This is accomplished by ...
Definition: Joint.hpp:657
Math::MatrixNd S_o
Definition: Joint.hpp:685
Math::MatrixNd S
Definition: Joint.hpp:684
Math::SpatialTransform XJ
Definition: Joint.hpp:683
Math::VectorNd d_u
Definition: Joint.hpp:689
virtual ~CustomJoint()
Destructor.
Definition: Joint.hpp:668
virtual void jcalc(Model &model, unsigned int joint_id, const Math::VectorNd &q, const Math::VectorNd &qdot)=0
CustomJoint()
Constructor.
Definition: Joint.hpp:661
Math::VectorNd ndof0_vec
Definition: Joint.hpp:690
Math::MatrixNd U
Definition: Joint.hpp:686
Math::VectorNd u
Definition: Joint.hpp:688
virtual void jcalc_X_lambda_S(Model &model, unsigned int joint_id, const Math::VectorNd &q)=0
Math::MatrixNd Dinv
Definition: Joint.hpp:687
unsigned int mDoFCount
Definition: Joint.hpp:682
Describes a joint relative to the predecessor body.
Definition: Joint.hpp:223
unsigned int q_index
Definition: Joint.hpp:628
unsigned int custom_joint_index
Definition: Joint.hpp:629
Joint(const Math::SpatialVector &axis_0, const Math::SpatialVector &axis_1, const Math::SpatialVector &axis_2)
Constructs a 3 DoF joint with the given motion subspaces.
Definition: Joint.hpp:478
Joint(JointType type)
Definition: Joint.hpp:228
Joint(const Math::SpatialVector &axis_0, const Math::SpatialVector &axis_1, const Math::SpatialVector &axis_2, const Math::SpatialVector &axis_3, const Math::SpatialVector &axis_4)
Constructs a 5 DoF joint with the given motion subspaces.
Definition: Joint.hpp:533
JointType mJointType
Type of joint.
Definition: Joint.hpp:622
Joint()
Definition: Joint.hpp:224
~Joint()
Definition: Joint.hpp:369
Joint(const Math::SpatialVector &axis_0, const Math::SpatialVector &axis_1, const Math::SpatialVector &axis_2, const Math::SpatialVector &axis_3)
Constructs a 4 DoF joint with the given motion subspaces.
Definition: Joint.hpp:504
Joint(const Math::SpatialVector &axis_0, const Math::SpatialVector &axis_1, const Math::SpatialVector &axis_2, const Math::SpatialVector &axis_3, const Math::SpatialVector &axis_4, const Math::SpatialVector &axis_5)
Constructs a 6 DoF joint with the given motion subspaces.
Definition: Joint.hpp:566
unsigned int mDoFCount
Number of degrees of freedom of the joint. Note: CustomJoints.
Definition: Joint.hpp:627
Joint(const JointType joint_type, const Math::Vector3d &joint_axis)
Constructs a joint from the given cartesian parameters.
Definition: Joint.hpp:389
bool validate_spatial_axis(Math::SpatialVector &axis)
Checks whether we have pure rotational or translational axis.
Definition: Joint.hpp:592
Joint(JointType type, int degreesOfFreedom)
Definition: Joint.hpp:317
Joint & operator=(const Joint &joint)
Definition: Joint.hpp:345
Joint(const Math::SpatialVector &axis_0)
Constructs a 1 DoF joint with the given motion subspaces.
Definition: Joint.hpp:423
Joint(const Joint &joint)
Definition: Joint.hpp:335
Joint(const Math::SpatialVector &axis_0, const Math::SpatialVector &axis_1)
Constructs a 2 DoF joint with the given motion subspaces.
Definition: Joint.hpp:457
Math::SpatialVector * mJointAxes
The spatial axes of the joint.
Definition: Joint.hpp:619
Contains all information about the rigid body model.
Definition: Model.hpp:112