23class RBY1_SDK_API
Link :
public std::enable_shared_from_this<Link> {
30 static std::shared_ptr<Link> Make(std::string name, Inertial::MatrixType I = Inertial::I(1.));
32 std::string GetName()
const;
34 std::weak_ptr<const Joint> GetParentJoint()
const;
36 std::weak_ptr<Joint> GetParentJoint();
38 std::vector<std::shared_ptr<Joint>> GetChildJointList();
40 const std::vector<std::shared_ptr<Joint>>& GetChildJointList()
const;
42 void AddCollision(
const std::shared_ptr<Collision>& collision);
44 std::vector<std::shared_ptr<Collision>> GetCollisions();
46 const std::vector<std::shared_ptr<Collision>>& GetCollisions()
const;
49 Link(std::string name, Inertial::MatrixType I);
53 Inertial::MatrixType I_{};
55 std::weak_ptr<Joint> parent_joint_;
56 std::vector<std::shared_ptr<Joint>> child_joints_;
58 std::vector<std::shared_ptr<Collision>> collisions_;
61class RBY1_SDK_API
Collision :
public std::enable_shared_from_this<Collision> {
65 std::string GetName()
const;
67 void SetOrigin(
const math::SE3::MatrixType& T);
69 math::SE3::MatrixType GetOrigin()
const;
71 void AddGeom(
const std::shared_ptr<Geom>& geom);
73 std::vector<std::shared_ptr<Geom>> GetGeoms();
75 const std::vector<std::shared_ptr<Geom>>& GetGeoms()
const;
79 math::SE3::MatrixType T_{math::SE3::Identity()};
80 std::vector<std::shared_ptr<Geom>> geoms_;
83class RBY1_SDK_API
Geom :
public std::enable_shared_from_this<Geom> {
85 Geom(
unsigned int coltype = 0,
unsigned int colaffinity = 0) : coltype_(coltype), colaffinity_(colaffinity) {}
87 virtual ~Geom() =
default;
89 virtual GeomType GetType()
const = 0;
91 unsigned int GetColtype()
const {
return coltype_; }
93 unsigned int GetColaffinity()
const {
return colaffinity_; }
95 virtual std::optional<CollisionResult> ComputeMinimumDistance(
const math::SE3::MatrixType& T,
const Geom& other_geom,
96 const math::SE3::MatrixType& other_T)
const = 0;
98 bool Filter(
const Geom& other_geom)
const {
99 return (coltype_ & other_geom.colaffinity_) || (other_geom.coltype_ & colaffinity_);
103 unsigned int coltype_;
104 unsigned int colaffinity_;
109 GeomCapsule(
double length,
double radius,
unsigned int coltype = 0,
unsigned int colaffinity = 0);
111 GeomCapsule(Eigen::Vector3d sp, Eigen::Vector3d ep,
double radius,
unsigned int coltype = 0,
112 unsigned int colaffinity = 0);
114 GeomType GetType()
const override;
116 std::optional<CollisionResult> ComputeMinimumDistance(
const math::SE3::MatrixType& T,
const Geom& other_geom,
117 const math::SE3::MatrixType& other_T)
const override;
119 Eigen::Vector3d GetStartPoint()
const;
121 Eigen::Vector3d GetEndPoint()
const;
123 double GetRadius()
const;