5#include <Eigen/Geometry>
11namespace tinyrobotics {
28 template <
typename Scalar>
44 Eigen::Matrix<Scalar, 3, 1>
axis = Eigen::Matrix<Scalar, 3, 1>::Zero();
48 Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
52 Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
61 Eigen::Matrix<Scalar, 6, 6>
X = Eigen::Matrix<Scalar, 6, 6>::Identity();
64 Eigen::Matrix<Scalar, 6, 1>
S = Eigen::Matrix<Scalar, 6, 1>::Zero();
73 case JointType::UNKNOWN:
return "Unknown";
74 case JointType::REVOLUTE:
return "Revolute";
75 case JointType::CONTINUOUS:
return "Continuous";
76 case JointType::PRISMATIC:
return "Prismatic";
77 case JointType::FLOATING:
return "Floating";
78 case JointType::PLANAR:
return "Planar";
79 case JointType::FIXED:
return "Fixed";
80 default:
return "Invalid";
90 Eigen::Transform<Scalar, 3, Eigen::Isometry> T = Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
92 case JointType::REVOLUTE: T.linear() = Eigen::AngleAxis<Scalar>(q,
axis).toRotationMatrix();
break;
93 case JointType::PRISMATIC: T.translation() = q *
axis;
break;
94 case JointType::FIXED:
break;
95 default:
throw std::runtime_error(
"Joint type not supported.");
114 template <
typename NewScalar>
121 new_joint.
axis =
axis.template cast<NewScalar>();
126 new_joint.
X =
X.template cast<NewScalar>();
127 new_joint.
S =
S.template cast<NewScalar>();
JointType
The types of joints.
Definition: joint.hpp:14
@ REVOLUTE
Revolute joint, can rotate about an axis.
@ UNKNOWN
Unknown joint type.
@ FLOATING
Floating joint, can translate and rotate about any axis.
@ PRISMATIC
Prismatic joint, can translate along an axis.
@ CONTINUOUS
Continuous joint.
@ FIXED
Fixed joint, cannot move.
Represents a joint in a tinyrobotics model which connects two links.
Definition: joint.hpp:29
std::string get_type() const
Get joint type as a string.
Definition: joint.hpp:71
Eigen::Matrix< Scalar, 6, 6 > X
Spatial transformation matrix from the parent to the child link.
Definition: joint.hpp:61
Joint< NewScalar > cast() const
Casts the joint to a new scalar type.
Definition: joint.hpp:115
std::string parent_link_name
Name of the joints parent link.
Definition: joint.hpp:55
Eigen::Matrix< Scalar, 3, 1 > axis
Axis of motion for the joint.
Definition: joint.hpp:44
Eigen::Transform< Scalar, 3, Eigen::Isometry > get_parent_to_child_transform(const Scalar &q)
Compute the transform from parent to child.
Definition: joint.hpp:105
Eigen::Transform< Scalar, 3, Eigen::Isometry > get_joint_transform(const Scalar &q) const
Compute the joint transform.
Definition: joint.hpp:89
JointType type
Type of the joint.
Definition: joint.hpp:41
std::string child_link_name
Name of the joints child link.
Definition: joint.hpp:58
std::string name
Name of the joint.
Definition: joint.hpp:38
int joint_id
Index of the joint in the tinyrobotics model's joint vector.
Definition: joint.hpp:32
Eigen::Transform< Scalar, 3, Eigen::Isometry > parent_transform
Homogeneous transform to the parent link.
Definition: joint.hpp:47
Eigen::Transform< Scalar, 3, Eigen::Isometry > child_transform
Homogeneous transform to the child link.
Definition: joint.hpp:51
Eigen::Matrix< Scalar, 6, 1 > S
Spatial axis.
Definition: joint.hpp:64
int idx
Index of the joint in the tinyrobotics model's configuration vector.
Definition: joint.hpp:35