8
8
9
9
namespace franky {
10
10
11
+ /* *
12
+ * @class RobotPose
13
+ * @brief A class to represent the cartesian pose of a robot.
14
+ *
15
+ * This class encapsulates the cartesian pose of a robot, which comprises the end effector pose and the elbow position.
16
+ */
11
17
class RobotPose {
12
18
public:
13
19
RobotPose ();
@@ -17,39 +23,100 @@ class RobotPose {
17
23
// Suppress implicit conversion warning
18
24
#pragma clang diagnostic push
19
25
#pragma clang diagnostic ignored "-Wimplicit-conversion"
26
+ /* *
27
+ * @param end_effector_pose The pose of the end effector.
28
+ * @param elbow_position The position of the elbow. Optional.
29
+ */
20
30
RobotPose (Affine end_effector_pose, std::optional<double > elbow_position = std::nullopt);
21
31
#pragma clang diagnostic pop
22
32
33
+ /* *
34
+ * @param vector_repr The vector representation of the pose.
35
+ * @param ignore_elbow Whether to ignore the elbow position. Default is false.
36
+ */
23
37
explicit RobotPose (const Vector7d &vector_repr, bool ignore_elbow = false );
24
38
39
+ /* *
40
+ * @param vector_repr The vector representation of the pose.
41
+ * @param elbow_position The position of the elbow. Optional.
42
+ */
25
43
explicit RobotPose (const Vector6d &vector_repr, std::optional<double > elbow_position = std::nullopt);
26
44
45
+ /* *
46
+ * @param franka_pose The franka pose.
47
+ */
27
48
explicit RobotPose (franka::CartesianPose franka_pose);
28
49
50
+ /* *
51
+ * @brief Get the vector representation of the pose, which consists of the end effector position and orientation
52
+ * (as rotation vector) and the elbow position.
53
+ *
54
+ * @return The vector representation of the pose.
55
+ */
29
56
[[nodiscard]] Vector7d vector_repr () const ;
30
57
58
+ /* *
59
+ * @brief Convert this pose to a franka pose.
60
+ *
61
+ * @return The franka pose.
62
+ */
31
63
[[nodiscard]] franka::CartesianPose as_franka_pose () const ;
32
64
65
+ /* *
66
+ * @brief Transform this pose with a given affine transformation from the left side.
67
+ *
68
+ * @param transform The transform to apply.
69
+ * @return The transformed robot pose.
70
+ */
33
71
[[nodiscard]] inline RobotPose leftTransform (const Affine &transform) const {
34
72
return {transform * end_effector_pose_, elbow_position_};
35
73
}
36
74
75
+ /* *
76
+ * @brief Transform this pose with a given affine transformation from the right side.
77
+ *
78
+ * @param transform The transform to apply.
79
+ * @return The transformed robot pose.
80
+ */
37
81
[[nodiscard]] inline RobotPose rightTransform (const Affine &transform) const {
38
82
return {end_effector_pose_ * transform, elbow_position_};
39
83
}
40
84
85
+ /* *
86
+ * @brief Change the frame of the end effector by applying a transformation from the right side. This is equivalent to
87
+ * calling rightTransform(transform).
88
+ *
89
+ * @param transform The transform to apply.
90
+ * @return The robot pose with the new end effector frame.
91
+ */
41
92
[[nodiscard]] inline RobotPose changeEndEffectorFrame (const Affine &transform) const {
42
- return {end_effector_pose_ * transform, elbow_position_} ;
93
+ return rightTransform ( transform) ;
43
94
}
44
95
96
+ /* *
97
+ * @brief Get the pose with a new elbow position.
98
+ *
99
+ * @param elbow_position The new elbow position.
100
+ * @return The pose with the new elbow position.
101
+ */
45
102
[[nodiscard]] inline RobotPose withElbowPosition (const std::optional<double > elbow_position) const {
46
103
return {end_effector_pose_, elbow_position};
47
104
}
48
105
106
+ /* *
107
+ * @brief Get the end effector pose.
108
+ *
109
+ * @return The end effector pose.
110
+ */
49
111
[[nodiscard]] inline Affine end_effector_pose () const {
50
112
return end_effector_pose_;
51
113
}
52
114
115
+ /* *
116
+ * @brief Get the elbow position.
117
+ *
118
+ * @return The elbow position.
119
+ */
53
120
[[nodiscard]] inline std::optional<double > elbow_position () const {
54
121
return elbow_position_;
55
122
}
0 commit comments