Control Libraries 6.3.4
Loading...
Searching...
No Matches
CartesianPose.hpp
1#pragma once
2
3#include "state_representation/space/cartesian/CartesianState.hpp"
4#include "state_representation/space/cartesian/CartesianTwist.hpp"
5#include "state_representation/space/cartesian/CartesianAcceleration.hpp"
6#include "state_representation/space/cartesian/CartesianWrench.hpp"
7
8namespace state_representation {
9class CartesianTwist;
10class CartesianAcceleration;
11class CartesianWrench;
12
18private:
20
21public:
22 // delete inaccessible getter and setters
23 const Eigen::Vector3d& get_linear_velocity() const = delete;
24 const Eigen::Vector3d& get_angular_velocity() const = delete;
25 Eigen::Matrix<double, 6, 1> get_twist() 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_linear_velocity(const Eigen::Vector3d& linear_velocity) = delete;
33 void set_linear_velocity(const std::vector<double>& linear_velocity) = delete;
34 void set_linear_velocity(const double& x, const double& y, const double& z) = delete;
35 void set_angular_velocity(const Eigen::Vector3d& angular_velocity) = delete;
36 void set_angular_velocity(const std::vector<double>& angular_velocity) = delete;
37 void set_angular_velocity(const double& x, const double& y, const double& z) = delete;
38 void set_twist(const Eigen::Matrix<double, 6, 1>& twist) = delete;
39 void set_twist(const std::vector<double>& twist) = delete;
40 void set_linear_acceleration(const Eigen::Vector3d& linear_acceleration) = delete;
41 void set_linear_acceleration(const std::vector<double>& linear_acceleration) = delete;
42 void set_linear_acceleration(const double& x, const double& y, const double& z) = delete;
43 void set_angular_acceleration(const Eigen::Vector3d& angular_acceleration) = delete;
44 void set_angular_acceleration(const std::vector<double>& angular_acceleration) = delete;
45 void set_angular_acceleration(const double& x, const double& y, const double& z) = delete;
46 void set_acceleration(const Eigen::Matrix<double, 6, 1>& acceleration) = delete;
47 void set_acceleration(const std::vector<double>& acceleration) = delete;
48 void set_force(const Eigen::Vector3d& force) = delete;
49 void set_force(const std::vector<double>& force) = delete;
50 void set_force(const double& x, const double& y, const double& z) = delete;
51 void set_torque(const Eigen::Vector3d& torque) = delete;
52 void set_torque(const std::vector<double>& torque) = delete;
53 void set_torque(const double& x, const double& y, const double& z) = delete;
54 void set_wrench(const Eigen::Matrix<double, 6, 1>& wrench) = delete;
55 void set_wrench(const std::vector<double>& wrench) = delete;
56 CartesianState operator*=(const CartesianState& state) = delete;
57 friend CartesianState operator*=(const CartesianState& state, const CartesianPose& pose) = delete;
58
62 explicit CartesianPose();
63
69 explicit CartesianPose(const std::string& name, const std::string& reference = "world");
70
74 CartesianPose(const CartesianPose& pose);
75
79 CartesianPose(const CartesianState& state);
80
84 CartesianPose(const CartesianTwist& twist);
85
92 explicit CartesianPose(
93 const std::string& name, const Eigen::Vector3d& position, const std::string& reference = "world"
94 );
95
104 explicit CartesianPose(
105 const std::string& name, double x, double y, double z, const std::string& reference = "world"
106 );
107
114 explicit CartesianPose(
115 const std::string& name, const Eigen::Quaterniond& orientation, const std::string& reference = "world"
116 );
117
125 explicit CartesianPose(
126 const std::string& name, const Eigen::Vector3d& position, const Eigen::Quaterniond& orientation,
127 const std::string& reference = "world"
128 );
129
136 static CartesianPose Identity(const std::string& name, const std::string& reference = "world");
137
144 static CartesianPose Random(const std::string& name, const std::string& reference = "world");
145
151 CartesianPose& operator=(const CartesianPose& pose) = default;
152
158 Eigen::Vector3d operator*(const Eigen::Vector3d& vector) const;
159
165 CartesianPose& operator*=(const CartesianPose& pose);
166
172 CartesianPose operator*(const CartesianPose& pose) const;
173
179 CartesianState operator*(const CartesianState& state) const;
180
186 CartesianTwist operator*(const CartesianTwist& twist) const;
187
193 CartesianAcceleration operator*(const CartesianAcceleration& acceleration) const;
194
200 CartesianWrench operator*(const CartesianWrench& wrench) const;
201
207 CartesianPose& operator*=(double lambda);
208
214 CartesianPose operator*(double lambda) const;
215
221 CartesianPose& operator/=(double lambda);
222
228 CartesianPose operator/(double lambda) const;
229
236
242 CartesianPose operator+(const CartesianPose& pose) const;
243
250
256 CartesianPose operator-(const CartesianPose& pose) const;
257
263 CartesianTwist operator/(const std::chrono::nanoseconds& dt) const;
264
269 CartesianPose copy() const;
270
275 Eigen::VectorXd data() const override;
276
281 void set_data(const Eigen::VectorXd& data) override;
282
287 void set_data(const std::vector<double>& data) override;
288
294 std::vector<double>
295 norms(const CartesianStateVariable& state_variable_type = CartesianStateVariable::POSE) const override;
296
301 CartesianPose inverse() const;
302
308 CartesianPose normalized(const CartesianStateVariable& state_variable_type = CartesianStateVariable::POSE) const;
309
316 friend std::ostream& operator<<(std::ostream& os, const CartesianPose& pose);
317
323 friend CartesianPose operator*(const CartesianState& state, const CartesianPose& pose);
324
330 friend CartesianPose operator*(double lambda, const CartesianPose& pose);
331};
332
333inline std::vector<double> CartesianPose::norms(const CartesianStateVariable& state_variable_type) const {
334 return CartesianState::norms(state_variable_type);
335}
336
337inline CartesianPose CartesianPose::normalized(const CartesianStateVariable& state_variable_type) const {
338 return CartesianState::normalized(state_variable_type);
339}
340}// 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.
void set_data(const Eigen::VectorXd &data) override
Set the pose data from an Eigen vector.
friend std::ostream & operator<<(std::ostream &os, const CartesianPose &pose)
Overload the ostream operator for printing.
CartesianPose & operator-=(const CartesianPose &pose)
Overload the -= operator.
friend CartesianPose operator*(const CartesianState &state, const CartesianPose &pose)
Overload the * operator with a CartesianState.
std::vector< double > norms(const CartesianStateVariable &state_variable_type=CartesianStateVariable::POSE) const override
Compute the norms of the state variable specified by the input type (default is full pose)
CartesianPose & operator=(const CartesianPose &pose)=default
Copy assignment operator that have to be defined to the custom assignment operator.
CartesianPose operator-(const CartesianPose &pose) const
Overload the - operator with a pose.
CartesianPose & operator/=(double lambda)
Overload the /= operator with a scalar.
static CartesianPose Identity(const std::string &name, const std::string &reference="world")
Constructor for the identity pose.
CartesianPose & operator+=(const CartesianPose &pose)
Overload the += operator.
Eigen::VectorXd data() const override
Returns the pose data as an Eigen vector.
CartesianPose normalized(const CartesianStateVariable &state_variable_type=CartesianStateVariable::POSE) const
Compute the normalized pose at the state variable given in argument (default is full pose)
CartesianPose operator/(double lambda) const
Overload the / operator with a scalar.
CartesianPose copy() const
Return a copy of the CartesianPose.
CartesianPose operator+(const CartesianPose &pose) const
Overload the + operator with a pose.
CartesianPose inverse() const
Compute the inverse of the current CartesianPose.
static CartesianPose Random(const std::string &name, const std::string &reference="world")
Constructor for a random pose.
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.
Class to define wrench in cartesian space as 3D force and torque vectors.
Core state variables and objects.