Control Libraries 6.3.4
Loading...
Searching...
No Matches
JointAccelerations.hpp
1#pragma once
2
3#include "state_representation/space/joint/JointState.hpp"
4#include "state_representation/space/joint/JointVelocities.hpp"
5
6namespace state_representation {
7class JointVelocities;
8
14private:
16
17public:
18 const Eigen::VectorXd& get_positions() const = delete;
19 double get_position(unsigned int joint_index) const = delete;
20 double get_position(const std::string& joint_name) const = delete;
21 void set_positions(const Eigen::VectorXd& positions) = delete;
22 void set_positions(const std::vector<double>& positions) = delete;
23 void set_position(double position, unsigned int joint_index) const = delete;
24 void set_position(double position, const std::string& joint_name) const = delete;
25 const Eigen::VectorXd& get_velocities() const = delete;
26 double get_velocity(unsigned int joint_index) const = delete;
27 double get_velocity(const std::string& joint_name) const = delete;
28 void set_velocities(const Eigen::VectorXd& accelerations) = delete;
29 void set_velocities(const std::vector<double>& accelerations) = delete;
30 void set_velocity(double velocity, unsigned int joint_index) const = delete;
31 void set_velocity(double velocity, const std::string& joint_name) const = delete;
32 const Eigen::VectorXd& get_torques() const = delete;
33 double get_torque(unsigned int joint_index) const = delete;
34 double get_torque(const std::string& joint_name) const = delete;
35 void set_torques(const Eigen::VectorXd& torques) = delete;
36 void set_torques(const std::vector<double>& torques) = delete;
37 void set_torque(double torque, unsigned int joint_index) const = delete;
38 void set_torque(double torque, const std::string& joint_name) const = delete;
39
43 explicit JointAccelerations();
44
50 explicit JointAccelerations(const std::string& robot_name, unsigned int nb_joints = 0);
51
57 explicit JointAccelerations(const std::string& robot_name, const std::vector<std::string>& joint_names);
58
64 explicit JointAccelerations(const std::string& robot_name, const Eigen::VectorXd& accelerations);
65
72 explicit JointAccelerations(
73 const std::string& robot_name, const std::vector<std::string>& joint_names, const Eigen::VectorXd& accelerations
74 );
75
79 JointAccelerations(const JointAccelerations& accelerations);
80
84 JointAccelerations(const JointState& state);
85
90 JointAccelerations(const JointVelocities& velocities);
91
98 static JointAccelerations Zero(const std::string& robot_name, unsigned int nb_joints);
99
106 static JointAccelerations Zero(const std::string& robot_name, const std::vector<std::string>& joint_names);
107
114 static JointAccelerations Random(const std::string& robot_name, unsigned int nb_joints);
115
122 static JointAccelerations Random(const std::string& robot_name, const std::vector<std::string>& joint_names);
123
129 JointAccelerations& operator=(const JointAccelerations& accelerations) = default;
130
136 JointAccelerations& operator+=(const JointAccelerations& accelerations);
137
143 JointAccelerations operator+(const JointAccelerations& accelerations) const;
144
150 JointAccelerations& operator-=(const JointAccelerations& accelerations);
151
157 JointAccelerations operator-(const JointAccelerations& accelerations) const;
158
164 JointAccelerations& operator*=(double lambda);
165
171 JointAccelerations operator*(double lambda) const;
172
178 JointAccelerations& operator*=(const Eigen::ArrayXd& lambda);
179
185 JointAccelerations operator*(const Eigen::ArrayXd& lambda) const;
186
192 JointAccelerations& operator*=(const Eigen::MatrixXd& lambda);
193
199 JointAccelerations operator*(const Eigen::MatrixXd& lambda) const;
200
206 JointAccelerations& operator/=(double lambda);
207
213 JointAccelerations operator/(double lambda) const;
214
220 JointVelocities operator*(const std::chrono::nanoseconds& dt) const;
221
226 JointAccelerations copy() const;
227
232 Eigen::VectorXd data() const override;
233
238 virtual void set_data(const Eigen::VectorXd& data) override;
239
244 virtual void set_data(const std::vector<double>& data) override;
245
252 void clamp(double max_absolute_value, double noise_ratio = 0.);
253
261 JointAccelerations clamped(double max_absolute_value, double noise_ratio = 0.) const;
262
269 void clamp(const Eigen::ArrayXd& max_absolute_value_array, const Eigen::ArrayXd& noise_ratio_array);
270
279 const Eigen::ArrayXd& max_absolute_value_array, const Eigen::ArrayXd& noise_ratio_array
280 ) const;
281
288 friend std::ostream& operator<<(std::ostream& os, const JointAccelerations& accelerations);
289
295 friend JointAccelerations operator*(double lambda, const JointAccelerations& accelerations);
296
302 friend JointAccelerations operator*(const Eigen::ArrayXd& lambda, const JointAccelerations& accelerations);
303
309 friend JointAccelerations operator*(const Eigen::MatrixXd& lambda, const JointAccelerations& accelerations);
310
315 friend JointVelocities operator*(const std::chrono::nanoseconds& dt, const JointAccelerations& accelerations);
316};
317}// namespace state_representation
Class to define accelerations of the joints.
JointAccelerations copy() const
Return a copy of the JointAccelerations.
JointAccelerations & operator-=(const JointAccelerations &accelerations)
Overload the -= operator.
JointAccelerations & operator+=(const JointAccelerations &accelerations)
Overload the += operator.
JointAccelerations operator+(const JointAccelerations &accelerations) const
Overload the + operator.
Eigen::VectorXd data() const override
Returns the accelerations data as an Eigen vector.
JointAccelerations clamped(double max_absolute_value, double noise_ratio=0.) const
Return the acceleration clamped to the values in argument.
JointAccelerations & operator/=(double lambda)
Overload the /= operator with a scalar.
JointAccelerations operator-(const JointAccelerations &accelerations) const
Overload the - operator.
friend JointAccelerations operator*(double lambda, const JointAccelerations &accelerations)
Overload the * operator with a scalar.
virtual void set_data(const Eigen::VectorXd &data) override
Set the accelerations data from an Eigen vector.
static JointAccelerations Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for the zero JointAccelerations.
void clamp(double max_absolute_value, double noise_ratio=0.)
Clamp inplace the magnitude of the acceleration to the values in argument.
JointAccelerations operator/(double lambda) const
Overload the / operator with a scalar.
JointAccelerations & operator*=(double lambda)
Overload the *= operator with a double gain.
JointAccelerations & operator=(const JointAccelerations &accelerations)=default
Copy assignment operator that have to be defined to the custom assignment operator.
friend std::ostream & operator<<(std::ostream &os, const JointAccelerations &accelerations)
Overload the ostream operator for printing.
static JointAccelerations Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for the random JointAccelerations.
Class to define a state in joint space.
Definition: JointState.hpp:36
void clamp_state_variable(double max_absolute_value, const JointStateVariable &state_variable_type, double noise_ratio=0)
Clamp inplace the magnitude of the a specific joint state variable.
Definition: JointState.cpp:379
Class to define velocities of the joints.
Core state variables and objects.