Control Libraries 6.3.4
Loading...
Searching...
No Matches
JointTorques.hpp
1#pragma once
2
3#include "state_representation/space/joint/JointState.hpp"
4
5namespace state_representation {
10class JointTorques : public JointState {
11private:
13
14public:
15 const Eigen::VectorXd& get_positions() const = delete;
16 double get_position(unsigned int joint_index) const = delete;
17 double get_position(const std::string& joint_name) const = delete;
18 void set_positions(const Eigen::VectorXd& positions) = delete;
19 void set_positions(const std::vector<double>& positions) = delete;
20 void set_position(double position, unsigned int joint_index) const = delete;
21 void set_position(double position, const std::string& joint_name) const = delete;
22 const Eigen::VectorXd& get_velocities() const = delete;
23 double get_velocity(unsigned int joint_index) const = delete;
24 double get_velocity(const std::string& joint_name) const = delete;
25 void set_velocities(const Eigen::VectorXd& velocities) = delete;
26 void set_velocities(const std::vector<double>& velocities) = delete;
27 void set_velocity(double velocity, unsigned int joint_index) const = delete;
28 void set_velocity(double velocity, const std::string& joint_name) const = delete;
29 const Eigen::VectorXd& get_accelerations() const = delete;
30 double get_acceleration(unsigned int joint_index) const = delete;
31 double get_acceleration(const std::string& joint_name) const = delete;
32 void set_accelerations(const Eigen::VectorXd& accelerations) = delete;
33 void set_accelerations(const std::vector<double>& accelerations) = delete;
34 void set_acceleration(double acceleration, unsigned int joint_index) const = delete;
35 void set_acceleration(double acceleration, const std::string& joint_name) const = delete;
36
40 explicit JointTorques();
41
47 explicit JointTorques(const std::string& robot_name, unsigned int nb_joints = 0);
48
54 explicit JointTorques(const std::string& robot_name, const std::vector<std::string>& joint_names);
55
61 explicit JointTorques(const std::string& robot_name, const Eigen::VectorXd& torques);
62
69 explicit JointTorques(const std::string& robot_name, const std::vector<std::string>& joint_names,
70 const Eigen::VectorXd& torques);
71
75 JointTorques(const JointTorques& torques);
76
80 JointTorques(const JointState& state);
81
88 static JointTorques Zero(const std::string& robot_name, unsigned int nb_joints);
89
96 static JointTorques Zero(const std::string& robot_name, const std::vector<std::string>& joint_names);
97
104 static JointTorques Random(const std::string& robot_name, unsigned int nb_joints);
105
112 static JointTorques Random(const std::string& robot_name, const std::vector<std::string>& joint_names);
113
119 JointTorques& operator=(const JointTorques& torques) = default;
120
126 JointTorques& operator+=(const JointTorques& torques);
127
133 JointTorques operator+(const JointTorques& torques) const;
134
140 JointTorques& operator-=(const JointTorques& torques);
141
147 JointTorques operator-(const JointTorques& torques) const;
148
154 JointTorques& operator*=(double lambda);
155
161 JointTorques operator*(double lambda) const;
162
168 JointTorques& operator*=(const Eigen::ArrayXd& lambda);
169
175 JointTorques operator*(const Eigen::ArrayXd& lambda) const;
176
182 JointTorques& operator*=(const Eigen::MatrixXd& lambda);
183
189 JointTorques operator*(const Eigen::MatrixXd& lambda) const;
190
196 JointTorques& operator/=(double lambda);
197
203 JointTorques operator/(double lambda) const;
204
209 JointTorques copy() const;
210
215 Eigen::VectorXd data() const override;
216
221 virtual void set_data(const Eigen::VectorXd& data) override;
222
227 virtual void set_data(const std::vector<double>& data) override;
228
229
236 void clamp(double max_absolute_value, double noise_ratio = 0.);
237
245 JointTorques clamped(double max_absolute_value, double noise_ratio = 0.) const;
246
253 void clamp(const Eigen::ArrayXd& max_absolute_value_array, const Eigen::ArrayXd& noise_ratio_array);
254
262 JointTorques clamped(const Eigen::ArrayXd& max_absolute_value_array, const Eigen::ArrayXd& noise_ratio_array) const;
263
270 friend std::ostream& operator<<(std::ostream& os, const JointTorques& torques);
271
277 friend JointTorques operator*(double lambda, const JointTorques& torques);
278
284 friend JointTorques operator*(const Eigen::ArrayXd& lambda, const JointTorques& torques);
285
291 friend JointTorques operator*(const Eigen::MatrixXd& lambda, const JointTorques& torques);
292};
293}// namespace state_representation
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 torques of the joints.
friend std::ostream & operator<<(std::ostream &os, const JointTorques &torques)
Overload the ostream operator for printing.
void clamp(double max_absolute_value, double noise_ratio=0.)
Clamp inplace the magnitude of the torque to the values in argument.
JointTorques copy() const
Return a copy of the JointTorques.
JointTorques & operator+=(const JointTorques &torques)
Overload the += operator.
JointTorques clamped(double max_absolute_value, double noise_ratio=0.) const
Return the torque clamped to the values in argument.
JointTorques()
Empty constructor.
Definition: JointTorques.cpp:6
JointTorques & operator=(const JointTorques &torques)=default
Copy assignment operator that have to be defined to the custom assignment operator.
virtual void set_data(const Eigen::VectorXd &data) override
Set the torques data from an Eigen vector.
static JointTorques Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for the random JointTorques.
JointTorques operator+(const JointTorques &torques) const
Overload the + operator.
JointTorques & operator-=(const JointTorques &torques)
Overload the -= operator.
JointTorques operator-(const JointTorques &torques) const
Overload the - operator.
static JointTorques Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for the zero JointTorques.
JointTorques & operator/=(double lambda)
Overload the /= operator with a scalar.
JointTorques operator/(double lambda) const
Overload the / operator with a scalar.
JointTorques & operator*=(double lambda)
Overload the *= operator with a double gain.
Eigen::VectorXd data() const override
Returns the torques data as an Eigen vector.
friend JointTorques operator*(double lambda, const JointTorques &torques)
Overload the * operator with a scalar.
Core state variables and objects.