55#include < franka/control_types.h>
66
77#include " franky/types.hpp"
8+ #include " franky/elbow_state.hpp"
89
910namespace franky {
1011
@@ -24,31 +25,33 @@ class RobotPose {
2425#pragma clang diagnostic ignored "-Wimplicit-conversion"
2526 /* *
2627 * @param end_effector_pose The pose of the end effector.
27- * @param elbow_position The position of the elbow. Optional.
28+ * @param elbow_state The state of the elbow. Optional.
2829 */
29- RobotPose (Affine end_effector_pose, std::optional<double > elbow_position = std::nullopt );
30+ RobotPose (Affine end_effector_pose, std::optional<ElbowState> elbow_state = std::nullopt );
3031#pragma clang diagnostic pop
3132
3233 /* *
33- * @param vector_repr The vector representation of the pose.
34- * @param ignore_elbow Whether to ignore the elbow position. Default is false.
34+ * @param vector_repr The vector representation of the pose.
35+ * @param ignore_elbow Whether to ignore the elbow state. Default is false.
36+ * @param flip_direction The flip direction to use if the elbow is not ignored. Default is negative.
3537 */
36- explicit RobotPose (const Vector7d &vector_repr, bool ignore_elbow = false );
38+ explicit RobotPose (
39+ const Vector7d &vector_repr, bool ignore_elbow = false , FlipDirection flip_direction = FlipDirection::kNegative );
3740
3841 /* *
3942 * @param vector_repr The vector representation of the pose.
40- * @param elbow_position The position of the elbow. Optional.
43+ * @param elbow_state The state of the elbow. Optional.
4144 */
42- explicit RobotPose (const Vector6d &vector_repr, std::optional<double > elbow_position = std::nullopt );
45+ explicit RobotPose (const Vector6d &vector_repr, std::optional<ElbowState> elbow_state = std::nullopt );
4346
4447 /* *
4548 * @param franka_pose The franka pose.
4649 */
47- explicit RobotPose (franka::CartesianPose franka_pose);
50+ explicit RobotPose (const franka::CartesianPose & franka_pose);
4851
4952 /* *
5053 * @brief Get the vector representation of the pose, which consists of the end effector position and orientation
51- * (as rotation vector) and the elbow position.
54+ * (as rotation vector) and the elbow position. Does not contain the flip component of the elbow state.
5255 *
5356 * @return The vector representation of the pose.
5457 */
@@ -57,9 +60,11 @@ class RobotPose {
5760 /* *
5861 * @brief Convert this pose to a franka pose.
5962 *
63+ * @param default_elbow_flip_direction The default flip direction to use if the elbow flip direction is not set.
6064 * @return The franka pose.
6165 */
62- [[nodiscard]] franka::CartesianPose as_franka_pose () const ;
66+ [[nodiscard]] franka::CartesianPose as_franka_pose (
67+ FlipDirection default_elbow_flip_direction = FlipDirection::kNegative ) const ;
6368
6469 /* *
6570 * @brief Transform this pose with a given affine transformation from the left side.
@@ -68,7 +73,7 @@ class RobotPose {
6873 * @return The transformed robot pose.
6974 */
7075 [[nodiscard]] inline RobotPose leftTransform (const Affine &transform) const {
71- return {transform * end_effector_pose_, elbow_position_ };
76+ return {transform * end_effector_pose_, elbow_state_ };
7277 }
7378
7479 /* *
@@ -78,7 +83,7 @@ class RobotPose {
7883 * @return The transformed robot pose.
7984 */
8085 [[nodiscard]] inline RobotPose rightTransform (const Affine &transform) const {
81- return {end_effector_pose_ * transform, elbow_position_ };
86+ return {end_effector_pose_ * transform, elbow_state_ };
8287 }
8388
8489 /* *
@@ -93,13 +98,13 @@ class RobotPose {
9398 }
9499
95100 /* *
96- * @brief Get the pose with a new elbow position .
101+ * @brief Get the pose with a new elbow state .
97102 *
98- * @param elbow_position The new elbow position .
99- * @return The pose with the new elbow position .
103+ * @param elbow_state The new elbow state .
104+ * @return The pose with the new elbow state .
100105 */
101- [[nodiscard]] inline RobotPose withElbowPosition (const std::optional<double > elbow_position ) const {
102- return {end_effector_pose_, elbow_position };
106+ [[nodiscard]] inline RobotPose withElbowState (const std::optional<ElbowState> elbow_state ) const {
107+ return {end_effector_pose_, elbow_state };
103108 }
104109
105110 /* *
@@ -112,17 +117,17 @@ class RobotPose {
112117 }
113118
114119 /* *
115- * @brief Get the elbow position .
120+ * @brief Get the elbow state .
116121 *
117- * @return The elbow position .
122+ * @return The elbow state .
118123 */
119- [[nodiscard]] inline std::optional<double > elbow_position () const {
120- return elbow_position_ ;
124+ [[nodiscard]] inline std::optional<ElbowState> elbow_state () const {
125+ return elbow_state_ ;
121126 }
122127
123128 private:
124129 Affine end_effector_pose_;
125- std::optional<double > elbow_position_ ;
130+ std::optional<ElbowState> elbow_state_ ;
126131};
127132
128133inline RobotPose operator *(const RobotPose &robot_pose, const Affine &right_transform) {
0 commit comments