Franky 1.1.0
A High-Level Motion API for Franka
Loading...
Searching...
No Matches
robot_velocity.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <franka/control_types.h>
4
5#include <Eigen/Core>
6#include <optional>
7
9#include "franky/twist.hpp"
10#include "franky/types.hpp"
11
12namespace franky {
13
21 public:
23
25
26 // Suppress implicit conversion warning
27#pragma clang diagnostic push
28#pragma clang diagnostic ignored "-Wimplicit-conversion"
33 RobotVelocity(const Twist &end_effector_twist, std::optional<double> elbow_velocity = std::nullopt);
34#pragma clang diagnostic pop
35
40 explicit RobotVelocity(const Vector7d &vector_repr, bool ignore_elbow = false);
41
46 explicit RobotVelocity(const Vector6d &vector_repr, std::optional<double> elbow_velocity = std::nullopt);
47
51 explicit RobotVelocity(franka::CartesianVelocities franka_velocity);
52
60 [[nodiscard]] Vector7d vector_repr() const;
61
72 [[nodiscard]] franka::CartesianVelocities as_franka_velocity(
73 const std::optional<ElbowState> &elbow_state = std::nullopt,
75
83 [[nodiscard]] inline RobotVelocity transform(const Affine &affine) const { return transform(affine.rotation()); }
84
91 template <typename RotationMatrixType>
93 return {rotation * end_effector_twist_, elbow_velocity_};
94 }
95
105 [[nodiscard]] inline RobotVelocity changeEndEffectorFrame(const Eigen::Vector3d &offset_world_frame) const {
106 return {end_effector_twist_.propagateThroughLink(offset_world_frame), elbow_velocity_};
107 }
108
115 [[nodiscard]] inline RobotVelocity withElbowVelocity(const std::optional<double> elbow_velocity) const {
116 return {end_effector_twist_, elbow_velocity};
117 }
118
124 [[nodiscard]] inline Twist end_effector_twist() const { return end_effector_twist_; }
125
131 [[nodiscard]] inline std::optional<double> elbow_velocity() const { return elbow_velocity_; }
132
133 friend std::ostream &operator<<(std::ostream &os, const RobotVelocity &robot_velocity);
134
135 private:
136 Twist end_effector_twist_;
137 std::optional<double> elbow_velocity_ = std::nullopt;
138};
139
141 return robot_velocity.transform(affine);
142}
143
144template <typename RotationMatrixType>
148
149} // namespace franky
Cartesian velocity of a robot.
Definition robot_velocity.hpp:20
franka::CartesianVelocities as_franka_velocity(const std::optional< ElbowState > &elbow_state=std::nullopt, FlipDirection default_elbow_flip_direction=FlipDirection::kNegative) const
Get the franka velocity.
Definition robot_velocity.cpp:41
RobotVelocity(const RobotVelocity &robot_velocity)
RobotVelocity transform(const RotationMatrixType &rotation) const
Transform the frame of the velocity by applying the given rotation.
Definition robot_velocity.hpp:92
friend std::ostream & operator<<(std::ostream &os, const RobotVelocity &robot_velocity)
Definition robot_velocity.cpp:48
RobotVelocity transform(const Affine &affine) const
Transform the frame of the velocity by applying the given affine transform.
Definition robot_velocity.hpp:83
RobotVelocity withElbowVelocity(const std::optional< double > elbow_velocity) const
Get the velocity with a new elbow velocity.
Definition robot_velocity.hpp:115
Vector7d vector_repr() const
Get the vector representation of the velocity. It consists of the linear and angular velocity of the ...
Definition robot_velocity.cpp:35
RobotVelocity changeEndEffectorFrame(const Eigen::Vector3d &offset_world_frame) const
Change the end-effector frame by adding the given offset to the current end-effector frame....
Definition robot_velocity.hpp:105
std::optional< double > elbow_velocity() const
Get the elbow velocity.
Definition robot_velocity.hpp:131
Twist end_effector_twist() const
Get the end effector twist.
Definition robot_velocity.hpp:124
Twist of a frame.
Definition twist.hpp:13
Twist propagateThroughLink(const Eigen::Vector3d &link_translation) const
Propagate the twist through a link with the given translation. Hence, suppose this twist is the twist...
Definition twist.hpp:77
Definition dynamics_limit.cpp:8
std::array< double, dims > toStdD(const Eigen::Matrix< double, dims, 1 > &vector)
Definition util.hpp:18
CartesianState operator*(const Affine &transform, const CartesianState &cartesian_state)
Definition cartesian_state.hpp:76
Eigen::Vector< double, 7 > Vector7d
Definition types.hpp:11
Eigen::Vector< double, 6 > Vector6d
Definition types.hpp:10
FlipDirection
Flip direction of a joint.
Definition elbow_state.hpp:12
Eigen::Affine3d Affine
Definition types.hpp:15