5#include <Eigen/Geometry>
10namespace tinyrobotics {
27 template <
typename Scalar>
43 Eigen::Matrix<Scalar, 3, 1>
axis = Eigen::Matrix<Scalar, 3, 1>::Zero();
47 Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
51 Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
60 Eigen::Matrix<Scalar, 6, 6>
X = Eigen::Matrix<Scalar, 6, 6>::Identity();
63 Eigen::Matrix<Scalar, 6, 1>
S = Eigen::Matrix<Scalar, 6, 1>::Zero();
72 case JointType::UNKNOWN:
return "Unknown";
73 case JointType::REVOLUTE:
return "Revolute";
74 case JointType::CONTINUOUS:
return "Continuous";
75 case JointType::PRISMATIC:
return "Prismatic";
76 case JointType::FLOATING:
return "Floating";
77 case JointType::PLANAR:
return "Planar";
78 case JointType::FIXED:
return "Fixed";
79 default:
return "Invalid";
89 Eigen::Transform<Scalar, 3, Eigen::Isometry> T = Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
91 case JointType::REVOLUTE: {
92 T.linear() = Eigen::AngleAxis<Scalar>(q, Eigen::Matrix<Scalar, 3, 1>(
axis[0],
axis[1],
axis[2]))
97 case JointType::PRISMATIC: {
98 T.translation() = q * Eigen::Matrix<Scalar, 3, 1>(
axis[0],
axis[1],
axis[2]);
102 case JointType::FIXED: {
107 std::cout <<
"Joint type not supported." << std::endl;
128 template <
typename NewScalar>
135 new_joint.
axis =
axis.template cast<NewScalar>();
140 new_joint.
X =
X.template cast<NewScalar>();
JointType
The types of joints.
Definition: Joint.hpp:13
@ 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:28
std::string get_type() const
Get joint type as a string.
Definition: Joint.hpp:70
Eigen::Matrix< Scalar, 6, 6 > X
Spatial transformation matrix from the parent to the child link.
Definition: Joint.hpp:60
Joint< NewScalar > cast() const
Casts the joint to a new scalar type.
Definition: Joint.hpp:129
std::string parent_link_name
Name of the joints parent link.
Definition: Joint.hpp:54
Eigen::Matrix< Scalar, 3, 1 > axis
Axis of motion for the joint.
Definition: Joint.hpp:43
Eigen::Transform< Scalar, 3, Eigen::Isometry > get_parent_to_child_transform(const Scalar &q)
Compute the transform from parent to child.
Definition: Joint.hpp:119
Eigen::Transform< Scalar, 3, Eigen::Isometry > get_joint_transform(const Scalar &q) const
Compute the joint transform.
Definition: Joint.hpp:88
JointType type
Type of the joint.
Definition: Joint.hpp:40
std::string child_link_name
Name of the joints child link.
Definition: Joint.hpp:57
std::string name
Name of the joint.
Definition: Joint.hpp:37
int joint_id
Index of the joint in the tinyrobotics model's joint vector.
Definition: Joint.hpp:31
Eigen::Transform< Scalar, 3, Eigen::Isometry > parent_transform
Homogeneous transform to the parent link.
Definition: Joint.hpp:46
Eigen::Transform< Scalar, 3, Eigen::Isometry > child_transform
Homogeneous transform to the child link.
Definition: Joint.hpp:50
Eigen::Matrix< Scalar, 6, 1 > S
Spatial axis.
Definition: Joint.hpp:63
int idx
Index of the joint in the tinyrobotics model's configuration vector.
Definition: Joint.hpp:34