Control Libraries 6.3.4
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
7namespace state_representation {
8class CartesianPose;
9class CartesianTwist;
15private:
17
18public:
19 // delete inaccessible getter and setters
20 const Eigen::Vector3d& get_linear_velocity() const = delete;
21 const Eigen::Vector3d& get_angular_velocity() const = delete;
22 Eigen::Matrix<double, 6, 1> get_twist() const = delete;
23 const Eigen::Vector3d& get_position() const = delete;
24 const Eigen::Quaterniond& get_orientation() const = delete;
25 Eigen::Vector4d get_orientation_coefficients() const = delete;
26 Eigen::Matrix<double, 7, 1> get_pose() const = delete;
27 Eigen::Matrix4d get_transformation_matrix() const = delete;
28 const Eigen::Vector3d& get_linear_acceleration() const = delete;
29 const Eigen::Vector3d& get_angular_acceleration() const = delete;
30 Eigen::Matrix<double, 6, 1> get_acceleration() const = delete;
31 void set_position(const Eigen::Vector3d& position) = delete;
32 void set_position(const std::vector<double>& position) = delete;
33 void set_position(const double& x, const double& y, const double& z) = delete;
34 void set_orientation(const Eigen::Quaterniond& orientation) = delete;
35 void set_orientation(const Eigen::Vector4d& orientation) = delete;
36 void set_orientation(const std::vector<double>& orientation) = delete;
37 void set_orientation(const double& w, const double& x, const double& y, const double& z) = delete;
38 void set_pose(const Eigen::Vector3d& position, const Eigen::Quaterniond& orientation) = delete;
39 void set_pose(const Eigen::Matrix<double, 7, 1>& pose) = delete;
40 void set_pose(const std::vector<double>& pose) = delete;
41 void set_linear_velocity(const Eigen::Vector3d& linear_velocity) = delete;
42 void set_linear_velocity(const std::vector<double>& linear_velocity) = delete;
43 void set_linear_velocity(const double& x, const double& y, const double& z) = delete;
44 void set_angular_velocity(const Eigen::Vector3d& angular_velocity) = delete;
45 void set_angular_velocity(const std::vector<double>& angular_velocity) = delete;
46 void set_angular_velocity(const double& x, const double& y, const double& z) = delete;
47 void set_twist(const Eigen::Matrix<double, 6, 1>& twist) = delete;
48 void set_twist(const std::vector<double>& twist) = delete;
49 void set_linear_acceleration(const Eigen::Vector3d& linear_acceleration) = delete;
50 void set_linear_acceleration(const std::vector<double>& linear_acceleration) = delete;
51 void set_linear_acceleration(const double& x, const double& y, const double& z) = delete;
52 void set_angular_acceleration(const Eigen::Vector3d& angular_acceleration) = delete;
53 void set_angular_acceleration(const std::vector<double>& angular_acceleration) = delete;
54 void set_angular_acceleration(const double& x, const double& y, const double& z) = delete;
55 void set_acceleration(const Eigen::Matrix<double, 6, 1>& acceleration) = delete;
56 void set_acceleration(const std::vector<double>& acceleration) = delete;
57 CartesianState operator*=(const CartesianState& state) = delete;
58 CartesianState operator*(const CartesianState& state) = delete;
59 friend CartesianState operator*=(const CartesianState& state, const CartesianWrench& wrench) = delete;
60
64 explicit CartesianWrench();
65
71 explicit CartesianWrench(const std::string& name, const std::string& reference = "world");
72
76 CartesianWrench(const CartesianWrench& wrench);
77
81 CartesianWrench(const CartesianState& state);
82
86 explicit CartesianWrench(
87 const std::string& name, const Eigen::Vector3d& force, const std::string& reference = "world"
88 );
89
93 explicit CartesianWrench(
94 const std::string& name, const Eigen::Vector3d& force, const Eigen::Vector3d& torque,
95 const std::string& reference = "world"
96 );
97
101 explicit CartesianWrench(
102 const std::string& name, const Eigen::Matrix<double, 6, 1>& wrench, const std::string& reference = "world"
103 );
104
111 static CartesianWrench Zero(const std::string& name, const std::string& reference = "world");
112
119 static CartesianWrench Random(const std::string& name, const std::string& reference = "world");
120
126 CartesianWrench& operator=(const CartesianWrench& wrench) = default;
127
134
140 CartesianWrench operator+(const CartesianWrench& wrench) const;
141
148
154 CartesianWrench operator-(const CartesianWrench& wrench) const;
155
161 CartesianWrench& operator*=(double lambda);
162
168 CartesianWrench operator*(double lambda) const;
169
175 CartesianWrench& operator/=(double lambda);
176
182 CartesianWrench operator/(double lambda) const;
183
193 void clamp(double max_force, double max_torque, double force_noise_ratio = 0, double torque_noise_ratio = 0);
194
206 double max_force, double max_torque, double force_noise_ratio = 0, double torque_noise_ratio = 0
207 ) const;
208
213 CartesianWrench copy() const;
214
219 Eigen::VectorXd data() const override;
220
225 void set_data(const Eigen::VectorXd& data) override;
226
231 void set_data(const std::vector<double>& data) override;
232
237 CartesianWrench inverse() const;
238
244 std::vector<double>
245 norms(const CartesianStateVariable& state_variable_type = CartesianStateVariable::WRENCH) const override;
246
252 CartesianWrench normalized(const CartesianStateVariable& state_variable_type = CartesianStateVariable::WRENCH) const;
253
260 friend std::ostream& operator<<(std::ostream& os, const CartesianWrench& wrench);
261
267 friend CartesianWrench operator*(const CartesianState& state, const CartesianWrench& wrench);
268
274 friend CartesianWrench operator*(double lambda, const CartesianWrench& wrench);
275};
276
277inline std::vector<double> CartesianWrench::norms(const CartesianStateVariable& state_variable_type) const {
278 return CartesianState::norms(state_variable_type);
279}
280
281inline CartesianWrench CartesianWrench::normalized(const CartesianStateVariable& state_variable_type) const {
282 return CartesianState::normalized(state_variable_type);
283}
284}// namespace state_representation
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 wrench in cartesian space as 3D force and torque vectors.
CartesianWrench & operator+=(const CartesianWrench &wrench)
Overload the += operator.
CartesianWrench & operator-=(const CartesianWrench &wrench)
Overload the -= operator.
Eigen::VectorXd data() const override
Returns the wrench data as an Eigen vector.
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
Overload the / operator with 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.
friend CartesianWrench operator*(const CartesianState &state, const CartesianWrench &wrench)
Overload the * operator with a CartesianState.
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 have to be defined to the custom assignment operator.
CartesianWrench operator-(const CartesianWrench &wrench) const
Overload the - operator.
CartesianWrench copy() const
Return a copy of the CartesianWrench.
friend std::ostream & operator<<(std::ostream &os, const CartesianWrench &wrench)
Overload the ostream operator for printing.
CartesianWrench inverse() const
Compute the inverse of the current CartesianWrench.
CartesianWrench operator+(const CartesianWrench &wrench) const
Overload the + operator.
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)
Overload the /= operator with a scalar.
static CartesianWrench Random(const std::string &name, const std::string &reference="world")
Constructor for a random wrench.
Core state variables and objects.