tinyrobotics
Loading...
Searching...
No Matches
Link.hpp
Go to the documentation of this file.
1#ifndef TR_LINK_HPP
2#define TR_LINK_HPP
3
4#include "Joint.hpp"
5
9namespace tinyrobotics {
10
15 template <typename Scalar>
16 struct Link {
17
19 std::string name = "";
20
22 int idx = -1;
23
25 int parent = -1;
26
28 std::vector<int> child_links = {};
29
31 Eigen::Transform<Scalar, 3, Eigen::Isometry> centre_of_mass =
32 Eigen::Transform<Scalar, 3, Eigen::Isometry>::Identity();
33
35 Eigen::Matrix<Scalar, 3, 3> inertia = Eigen::Matrix<Scalar, 3, 3>::Zero();
36
38 Scalar mass = 0;
39
42
43 // @brief Spatial inertia matrix of the link.
44 Eigen::Matrix<Scalar, 6, 6> I = {};
45
50 void add_child_link_idx(const int child_link_idx) {
51 child_links.push_back(child_link_idx);
52 }
53
59 template <typename NewScalar>
62 new_link.name = name;
63 new_link.idx = idx;
64 new_link.parent = parent;
65 new_link.child_links = child_links;
66 new_link.centre_of_mass = centre_of_mass.template cast<NewScalar>();
67 new_link.inertia = inertia.template cast<NewScalar>();
68 new_link.mass = NewScalar(mass);
69 new_link.joint = joint.template cast<NewScalar>();
70 new_link.I = I.template cast<NewScalar>();
71 return new_link;
72 }
73 };
74} // namespace tinyrobotics
75#endif
Contains struct for representing a joint in a tinyrobotics model.
Represents a joint in a tinyrobotics model which connects two links.
Definition: Joint.hpp:28