Control Libraries 7.4.0
Loading...
Searching...
No Matches
CartesianWrench.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/CartesianTwist.hpp"
6#include "state_representation/space/cartesian/CartesianAcceleration.hpp"
7
8namespace state_representation {
9
10class CartesianPose;
11class CartesianTwist;
12class CartesianAcceleration;
13
19public:
20 // delete inaccessible getter and setters
21 const Eigen::Vector3d& get_linear_velocity() const = delete;
22 const Eigen::Vector3d& get_angular_velocity() const = delete;
23 Eigen::Matrix<double, 6, 1> get_twist() const = delete;
24 const Eigen::Vector3d& get_position() const = delete;
25 const Eigen::Quaterniond& get_orientation() const = delete;
26 Eigen::Vector4d get_orientation_coefficients() const = delete;
27 Eigen::Matrix<double, 7, 1> get_pose() const = delete;
28 Eigen::Matrix4d get_transformation_matrix() const = delete;
29 const Eigen::Vector3d& get_linear_acceleration() const = delete;
30 const Eigen::Vector3d& get_angular_acceleration() const = delete;
31 Eigen::Matrix<double, 6, 1> get_acceleration() 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_velocity(const Eigen::Vector3d& linear_velocity) = delete;
43 void set_linear_velocity(const std::vector<double>& linear_velocity) = delete;
44 void set_linear_velocity(const double& x, const double& y, const double& z) = delete;
45 void set_angular_velocity(const Eigen::Vector3d& angular_velocity) = delete;
46 void set_angular_velocity(const std::vector<double>& angular_velocity) = delete;
47 void set_angular_velocity(const double& x, const double& y, const double& z) = delete;
48 void set_twist(const Eigen::Matrix<double, 6, 1>& twist) = delete;
49 void set_twist(const std::vector<double>& twist) = delete;
50 void set_linear_acceleration(const Eigen::Vector3d& linear_acceleration) = delete;
51 void set_linear_acceleration(const std::vector<double>& linear_acceleration) = delete;
52 void set_linear_acceleration(const double& x, const double& y, const double& z) = delete;
53 void set_angular_acceleration(const Eigen::Vector3d& angular_acceleration) = delete;
54 void set_angular_acceleration(const std::vector<double>& angular_acceleration) = delete;
55 void set_angular_acceleration(const double& x, const double& y, const double& z) = delete;
56 void set_acceleration(const Eigen::Matrix<double, 6, 1>& acceleration) = delete;
57 void set_acceleration(const std::vector<double>& acceleration) = delete;
58 CartesianState inverse() const = delete;
59 CartesianState& operator*=(const CartesianState& state) = delete;
60 CartesianState operator*(const CartesianState& state) const = delete;
61 Eigen::Vector3d operator*(const Eigen::Vector3d& vector) const = delete;
62 CartesianState& operator+=(const CartesianPose& pose) = delete;
63 CartesianState& operator+=(const CartesianTwist& twist) = delete;
64 CartesianState& operator+=(const CartesianAcceleration& acceleration) = delete;
65 CartesianState operator+(const CartesianPose& pose) const = delete;
66 CartesianState operator+(const CartesianTwist& twist) const = delete;
67 CartesianState operator+(const CartesianAcceleration& acceleration) const = delete;
68 CartesianState& operator-=(const CartesianPose& pose) = delete;
69 CartesianState& operator-=(const CartesianTwist& twist) = delete;
70 CartesianState& operator-=(const CartesianAcceleration& acceleration) = delete;
71 CartesianState operator-(const CartesianPose& pose) const = delete;
72 CartesianState operator-(const CartesianTwist& twist) const = delete;
73 CartesianState operator-(const CartesianAcceleration& acceleration) const = delete;
74
78 explicit CartesianWrench();
79
85 explicit CartesianWrench(const std::string& name, const std::string& reference = "world");
86
90 CartesianWrench(const CartesianWrench& wrench);
91
95 CartesianWrench(const CartesianState& state);
96
100 explicit CartesianWrench(
101 const std::string& name, const Eigen::Vector3d& force, const std::string& reference = "world"
102 );
103
107 explicit CartesianWrench(
108 const std::string& name, const Eigen::Vector3d& force, const Eigen::Vector3d& torque,
109 const std::string& reference = "world"
110 );
111
115 explicit CartesianWrench(
116 const std::string& name, const Eigen::Matrix<double, 6, 1>& wrench, const std::string& reference = "world"
117 );
118
125 static CartesianWrench Zero(const std::string& name, const std::string& reference = "world");
126
133 static CartesianWrench Random(const std::string& name, const std::string& reference = "world");
134
140 CartesianWrench& operator=(const CartesianWrench& wrench) = default;
141
145 Eigen::VectorXd data() const override;
146
150 void set_data(const Eigen::VectorXd& data) override;
151
155 void set_data(const std::vector<double>& data) override;
156
166 void clamp(double max_force, double max_torque, double force_noise_ratio = 0, double torque_noise_ratio = 0);
167
179 double max_force, double max_torque, double force_noise_ratio = 0, double torque_noise_ratio = 0
180 ) const;
181
185 CartesianWrench copy() const;
186
192 CartesianWrench normalized(const CartesianStateVariable& state_variable_type = CartesianStateVariable::WRENCH) const;
193
199 std::vector<double>
200 norms(const CartesianStateVariable& state_variable_type = CartesianStateVariable::WRENCH) const override;
201
208 CartesianWrench& operator*=(double lambda);
209
216 CartesianWrench operator*(double lambda) const;
217
225 friend CartesianWrench operator*(double lambda, const CartesianWrench& wrench);
226
233 friend CartesianWrench
234 operator*(const Eigen::Matrix<double, 6, 6>& lambda, const CartesianWrench& wrench);
235
242 CartesianWrench& operator/=(double lambda);
243
250 CartesianWrench operator/(double lambda) const;
251
257 CartesianWrench& operator+=(const CartesianWrench& wrench);
258
264 CartesianWrench& operator+=(const CartesianState& state);
265
271 CartesianWrench operator+(const CartesianWrench& wrench) const;
272
278 CartesianState operator+(const CartesianState& state) const;
279
285
291 CartesianWrench& operator-=(const CartesianWrench& wrench);
292
298 CartesianWrench& operator-=(const CartesianState& state);
299
305 CartesianWrench operator-(const CartesianWrench& wrench) const;
306
312 CartesianState operator-(const CartesianState& state) const;
313
320 friend std::ostream& operator<<(std::ostream& os, const CartesianWrench& wrench);
321
322private:
324};
325
326}// namespace state_representation
Class to define acceleration in Cartesian space as 3D linear and angular acceleration vectors.
Class to define Cartesian pose in Cartesian space as 3D position and quaternion based orientation.
Class to represent a state in Cartesian space.
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.
Class to define wrench in Cartesian space as 3D force and torque vectors.
Eigen::VectorXd data() const override
Returns the wrench data as an Eigen vector.
friend CartesianWrench operator*(double lambda, const CartesianWrench &wrench)
Scale a Cartesian wrench by a scalar.
CartesianWrench normalized(const CartesianStateVariable &state_variable_type=CartesianStateVariable::WRENCH) const
Compute the normalized wrench at the state variable given in argument (default is full wrench)
CartesianWrench operator/(double lambda) const
Scale a Cartesian wrench by a scalar.
static CartesianWrench Zero(const std::string &name, const std::string &reference="world")
Constructor for the zero wrench.
void set_data(const Eigen::VectorXd &data) override
Set the wrench data from an Eigen vector.
CartesianWrench clamped(double max_force, double max_torque, double force_noise_ratio=0, double torque_noise_ratio=0) const
Return the clamped wrench.
std::vector< double > norms(const CartesianStateVariable &state_variable_type=CartesianStateVariable::WRENCH) const override
Compute the norms of the state variable specified by the input type (default is full wrench)
CartesianWrench & operator=(const CartesianWrench &wrench)=default
Copy assignment operator that has to be defined to the custom assignment operator.
CartesianWrench copy() const
Return a copy of the Cartesian wrench.
friend std::ostream & operator<<(std::ostream &os, const CartesianWrench &wrench)
Overload the ostream operator for printing.
CartesianWrench operator-() const
Negate a Cartesian wrench.
void clamp(double max_force, double max_torque, double force_noise_ratio=0, double torque_noise_ratio=0)
Clamp inplace the magnitude of the wrench to the values in argument.
CartesianWrench & operator/=(double lambda)
Scale inplace by a scalar.
static CartesianWrench Random(const std::string &name, const std::string &reference="world")
Constructor for a random wrench.
Core state variables and objects.