Control Libraries 6.3.4
Loading...
Searching...
No Matches
CartesianTwist.hpp
1#pragma once
2
3#include "state_representation/space/cartesian/CartesianState.hpp"
4#include "state_representation/space/cartesian/CartesianPose.hpp"
5#include "state_representation/space/cartesian/CartesianAcceleration.hpp"
6
7namespace state_representation {
8class CartesianPose;
9class CartesianAcceleration;
10
16private:
18
19public:
20 // delete inaccessible getter and setters
21 const Eigen::Vector3d& get_position() const = delete;
22 const Eigen::Quaterniond& get_orientation() const = delete;
23 Eigen::Vector4d get_orientation_coefficients() const = delete;
24 Eigen::Matrix<double, 7, 1> get_pose() const = delete;
25 Eigen::Matrix4d get_transformation_matrix() const = delete;
26 const Eigen::Vector3d& get_linear_acceleration() const = delete;
27 const Eigen::Vector3d& get_angular_acceleration() const = delete;
28 Eigen::Matrix<double, 6, 1> get_acceleration() const = delete;
29 const Eigen::Vector3d& get_force() const = delete;
30 const Eigen::Vector3d& get_torque() const = delete;
31 Eigen::Matrix<double, 6, 1> get_wrench() const = delete;
32 void set_position(const Eigen::Vector3d& position) = delete;
33 void set_position(const std::vector<double>& position) = delete;
34 void set_position(const double& x, const double& y, const double& z) = delete;
35 void set_orientation(const Eigen::Quaterniond& orientation) = delete;
36 void set_orientation(const Eigen::Vector4d& orientation) = delete;
37 void set_orientation(const std::vector<double>& orientation) = delete;
38 void set_orientation(const double& w, const double& x, const double& y, const double& z) = delete;
39 void set_pose(const Eigen::Vector3d& position, const Eigen::Quaterniond& orientation) = delete;
40 void set_pose(const Eigen::Matrix<double, 7, 1>& pose) = delete;
41 void set_pose(const std::vector<double>& pose) = delete;
42 void set_linear_acceleration(const Eigen::Vector3d& linear_acceleration) = delete;
43 void set_linear_acceleration(const std::vector<double>& linear_acceleration) = delete;
44 void set_linear_acceleration(const double& x, const double& y, const double& z) = delete;
45 void set_angular_acceleration(const Eigen::Vector3d& angular_acceleration) = delete;
46 void set_angular_acceleration(const std::vector<double>& angular_acceleration) = delete;
47 void set_angular_acceleration(const double& x, const double& y, const double& z) = delete;
48 void set_acceleration(const Eigen::Matrix<double, 6, 1>& acceleration) = delete;
49 void set_acceleration(const std::vector<double>& acceleration) = delete;
50 void set_force(const Eigen::Vector3d& force) = delete;
51 void set_force(const std::vector<double>& force) = delete;
52 void set_force(const double& x, const double& y, const double& z) = delete;
53 void set_torque(const Eigen::Vector3d& torque) = delete;
54 void set_torque(const std::vector<double>& torque) = delete;
55 void set_torque(const double& x, const double& y, const double& z) = delete;
56 void set_wrench(const Eigen::Matrix<double, 6, 1>& wrench) = delete;
57 void set_wrench(const std::vector<double>& wrench) = delete;
58 CartesianState operator*=(const CartesianState& state) = delete;
59 CartesianState operator*(const CartesianState& state) = delete;
60 friend CartesianState operator*=(const CartesianState& state, const CartesianTwist& twist) = delete;
61
65 explicit CartesianTwist();
66
72 explicit CartesianTwist(const std::string& name, const std::string& reference = "world");
73
77 CartesianTwist(const CartesianTwist& twist);
78
82 CartesianTwist(const CartesianState& state);
83
87 CartesianTwist(const CartesianPose& pose);
88
92 CartesianTwist(const CartesianAcceleration& acceleration);
93
97 explicit CartesianTwist(
98 const std::string& name, const Eigen::Vector3d& linear_velocity, const std::string& reference = "world"
99 );
100
104 explicit CartesianTwist(
105 const std::string& name, const Eigen::Vector3d& linear_velocity, const Eigen::Vector3d& angular_velocity,
106 const std::string& reference = "world"
107 );
108
112 explicit CartesianTwist(
113 const std::string& name, const Eigen::Matrix<double, 6, 1>& twist, const std::string& reference = "world"
114 );
115
122 static CartesianTwist Zero(const std::string& name, const std::string& reference = "world");
123
130 static CartesianTwist Random(const std::string& name, const std::string& reference = "world");
131
137 CartesianTwist& operator=(const CartesianTwist& twist) = default;
138
145
151 CartesianTwist operator+(const CartesianTwist& twist) const;
152
159
165 CartesianTwist operator-(const CartesianTwist& twist) const;
166
172 CartesianTwist& operator*=(double lambda);
173
179 CartesianTwist operator*(double lambda) const;
180
186 CartesianTwist& operator/=(double lambda);
187
193 CartesianTwist operator/(double lambda) const;
194
200 CartesianTwist& operator*=(const Eigen::Matrix<double, 6, 6>& lambda);
201
207 CartesianPose operator*(const std::chrono::nanoseconds& dt) const;
208
214 CartesianAcceleration operator/(const std::chrono::nanoseconds& dt) const;
215
225 void clamp(double max_linear, double max_angular, double linear_noise_ratio = 0, double angular_noise_ratio = 0);
226
238 double max_linear, double max_angular, double noise_ratio = 0, double angular_noise_ratio = 0
239 ) const;
240
245 CartesianTwist copy() const;
246
251 Eigen::VectorXd data() const override;
252
257 void set_data(const Eigen::VectorXd& data) override;
258
263 void set_data(const std::vector<double>& data) override;
264
269 CartesianTwist inverse() const;
270
276 std::vector<double>
277 norms(const CartesianStateVariable& state_variable_type = CartesianStateVariable::TWIST) const override;
278
284 CartesianTwist normalized(const CartesianStateVariable& state_variable_type = CartesianStateVariable::TWIST) const;
285
292 friend std::ostream& operator<<(std::ostream& os, const CartesianTwist& twist);
293
299 friend CartesianTwist operator*(const CartesianState& state, const CartesianTwist& twist);
300
306 friend CartesianTwist operator*(double lambda, const CartesianTwist& twist);
307
313 friend CartesianTwist operator*(const Eigen::Matrix<double, 6, 6>& lambda, const CartesianTwist& twist);
314
320 friend CartesianPose operator*(const std::chrono::nanoseconds& dt, const CartesianTwist& twist);
321};
322
323inline std::vector<double> CartesianTwist::norms(const CartesianStateVariable& state_variable_type) const {
324 return CartesianState::norms(state_variable_type);
325}
326
327inline CartesianTwist CartesianTwist::normalized(const CartesianStateVariable& state_variable_type) const {
328 return CartesianState::normalized(state_variable_type);
329}
330}// namespace state_representation
Class to define acceleration in cartesian space as 3D linear and angular acceleration vectors.
Class to define CartesianPose in cartesian space as 3D position and quaternion based orientation.
Class to represent a state in Cartesian space.
virtual std::vector< double > norms(const CartesianStateVariable &state_variable_type=CartesianStateVariable::ALL) const
Compute the norms of the state variable specified by the input type (default is full state)
CartesianState normalized(const CartesianStateVariable &state_variable_type=CartesianStateVariable::ALL) const
Compute the normalized state at the state variable given in argument (default is full state)
void clamp_state_variable(double max_norm, const CartesianStateVariable &state_variable_type, double noise_ratio=0)
Clamp inplace the norm of the a specific state variable.
Class to define twist in cartesian space as 3D linear and angular velocity vectors.
friend CartesianTwist operator*(const CartesianState &state, const CartesianTwist &twist)
Overload the * operator with a CartesianState.
CartesianTwist & operator+=(const CartesianTwist &twist)
Overload the += operator.
CartesianTwist operator-(const CartesianTwist &twist) const
Overload the - operator with a twist.
friend std::ostream & operator<<(std::ostream &os, const CartesianTwist &twist)
Overload the ostream operator for printing.
std::vector< double > norms(const CartesianStateVariable &state_variable_type=CartesianStateVariable::TWIST) const override
Compute the norms of the state variable specified by the input type (default is full twist)
Eigen::VectorXd data() const override
Returns the twist data as an Eigen vector.
CartesianTwist clamped(double max_linear, double max_angular, double noise_ratio=0, double angular_noise_ratio=0) const
Return the clamped twist.
static CartesianTwist Random(const std::string &name, const std::string &reference="world")
Constructor for a random twist.
CartesianTwist & operator-=(const CartesianTwist &twist)
Overload the -= operator.
static CartesianTwist Zero(const std::string &name, const std::string &reference="world")
Constructor for the zero twist.
void set_data(const Eigen::VectorXd &data) override
Set the twist data from an Eigen vector.
void clamp(double max_linear, double max_angular, double linear_noise_ratio=0, double angular_noise_ratio=0)
Clamp inplace the magnitude of the twist to the values in argument.
CartesianTwist operator+(const CartesianTwist &twist) const
Overload the + operator with a twist.
CartesianTwist copy() const
Return a copy of the CartesianTwist.
CartesianTwist normalized(const CartesianStateVariable &state_variable_type=CartesianStateVariable::TWIST) const
Compute the normalized twist at the state variable given in argument (default is full twist)
CartesianTwist operator/(double lambda) const
Overload the / operator with a scalar.
CartesianTwist inverse() const
Compute the inverse of the current CartesianTwist.
CartesianTwist & operator=(const CartesianTwist &twist)=default
Copy assignment operator that have to be defined to the custom assignment operator.
CartesianTwist & operator/=(double lambda)
Overload the /= operator with a scalar.
Core state variables and objects.