rby1-sdk
Loading...
Searching...
No Matches
joint.h
1#pragma once
2
3#include <Eigen/Core>
4#include <memory>
5
6#include "rby1-sdk/export.h"
7#include "rby1-sdk/math/liegroup.h"
8
9namespace rb::dyn {
10
11template <int DOF>
12class Robot;
13class Link;
14class Joint;
15
16class RBY1_SDK_API Joint : public std::enable_shared_from_this<Joint> {
17 public:
18 template <int DOF>
19 friend class Robot;
20
21 static std::shared_ptr<Joint> Make(std::string name, math::se3v::MatrixType S);
22
23 static std::shared_ptr<Joint> MakeRevoluteJoint(std::string name,
24 const math::SE3::MatrixType& T = math::SE3::Identity(),
25 const Eigen::Vector3d& axis = {0, 0, 1});
26
27 static std::shared_ptr<Joint> MakePrismaticJoint(std::string name,
28 const math::SE3::MatrixType& T = math::SE3::Identity(),
29 const Eigen::Vector3d& axis = {0, 0, 1});
30
31 static std::shared_ptr<Joint> MakeFixedJoint(std::string name);
32
33 std::string GetName() const;
34
35 void ConnectLinks(const std::shared_ptr<Link>& parent_link, const std::shared_ptr<Link>& child_link,
36 const math::SE3::MatrixType& T_pj = math::SE3::Identity(),
37 const math::SE3::MatrixType& T_jc = math::SE3::Identity());
38
39 void Disconnect();
40
41 void SetLimitQ(double lower, double upper);
42
43 void SetLimitQdot(double lower, double upper);
44
45 void SetLimitQddot(double lower, double upper);
46
47 void SetLimitTorque(double value);
48
49 double GetLimitQLower() const;
50
51 double GetLimitQUpper() const;
52
53 double GetLimitQdotLower() const;
54
55 double GetLimitQdotUpper() const;
56
57 double GetLimitQddotLower() const;
58
59 double GetLimitQddotUpper() const;
60
61 double GetLimitTorque() const;
62
63 void SetLimitQLower(double val);
64
65 void SetLimitQUpper(double val);
66
67 void SetLimitQdotLower(double val);
68
69 void SetLimitQdotUpper(double val);
70
71 void SetLimitQddotLower(double val);
72
73 void SetLimitQddotUpper(double val);
74
75 std::weak_ptr<const Link> GetParentLink() const;
76
77 std::weak_ptr<Link> GetParentLink();
78
79 std::shared_ptr<Link> GetChildLink();
80
81 std::shared_ptr<const Link> GetChildLink() const;
82
83 bool IsFixed() const;
84
85 private:
86 explicit Joint(std::string name);
87
88 Joint(std::string name, math::se3v::MatrixType S);
89
90 private:
91 std::string name_{};
92 bool fixed_;
93 math::se3v::MatrixType S_;
94 double limit_torque_{(std::numeric_limits<double>::max)()};
95 double limit_q_lower_{-(std::numeric_limits<double>::max)()};
96 double limit_q_upper_{(std::numeric_limits<double>::max)()};
97 double limit_qdot_lower_{-(std::numeric_limits<double>::max)()};
98 double limit_qdot_upper_{(std::numeric_limits<double>::max)()};
99 // double limit_qddot_lower_{-(std::numeric_limits<double>::max)()};
100 // double limit_qddot_upper_{(std::numeric_limits<double>::max)()};
101 double limit_qddot_lower_{-10.};
102 double limit_qddot_upper_{10.}; // (rad/s^2)
103
104 std::weak_ptr<Link> parent_link_;
105 std::shared_ptr<Link> child_link_{nullptr};
106 math::SE3::MatrixType T_pj_, T_jc_;
107};
108
109} // namespace rb::dyn
Definition joint.h:16
Definition state.h:10