Control Libraries 6.3.4
Loading...
Searching...
No Matches
JointVelocities.hpp
1#pragma once
2
3#include "state_representation/space/joint/JointState.hpp"
4#include "state_representation/space/joint/JointPositions.hpp"
5#include "state_representation/space/joint/JointAccelerations.hpp"
6
7namespace state_representation {
8class JointPositions;
9class JointAccelerations;
10
16private:
18
19public:
20 const Eigen::VectorXd& get_positions() const = delete;
21 double get_position(unsigned int joint_index) const = delete;
22 double get_position(const std::string& joint_name) const = delete;
23 void set_positions(const Eigen::VectorXd& positions) = delete;
24 void set_positions(const std::vector<double>& positions) = delete;
25 void set_position(double position, unsigned int joint_index) const = delete;
26 void set_position(double position, const std::string& joint_name) const = delete;
27 const Eigen::VectorXd& get_accelerations() const = delete;
28 double get_acceleration(unsigned int joint_index) const = delete;
29 double get_acceleration(const std::string& joint_name) const = delete;
30 void set_accelerations(const Eigen::VectorXd& accelerations) = delete;
31 void set_accelerations(const std::vector<double>& accelerations) = delete;
32 void set_acceleration(double acceleration, unsigned int joint_index) const = delete;
33 void set_acceleration(double acceleration, const std::string& joint_name) const = delete;
34 const Eigen::VectorXd& get_torques() const = delete;
35 double get_torque(unsigned int joint_index) const = delete;
36 double get_torque(const std::string& joint_name) const = delete;
37 void set_torques(const Eigen::VectorXd& torques) = delete;
38 void set_torques(const std::vector<double>& torques) = delete;
39 void set_torque(double torque, unsigned int joint_index) const = delete;
40 void set_torque(double torque, const std::string& joint_name) const = delete;
41
45 explicit JointVelocities();
46
52 explicit JointVelocities(const std::string& robot_name, unsigned int nb_joints = 0);
53
59 explicit JointVelocities(const std::string& robot_name, const std::vector<std::string>& joint_names);
60
66 explicit JointVelocities(const std::string& robot_name, const Eigen::VectorXd& velocities);
67
74 explicit JointVelocities(
75 const std::string& robot_name, const std::vector<std::string>& joint_names, const Eigen::VectorXd& velocities
76 );
77
81 JointVelocities(const JointVelocities& velocities);
82
86 JointVelocities(const JointState& state);
87
92 JointVelocities(const JointAccelerations& accelerations);
93
98 JointVelocities(const JointPositions& positions);
99
106 static JointVelocities Zero(const std::string& robot_name, unsigned int nb_joints);
107
114 static JointVelocities Zero(const std::string& robot_name, const std::vector<std::string>& joint_names);
115
122 static JointVelocities Random(const std::string& robot_name, unsigned int nb_joints);
123
130 static JointVelocities Random(const std::string& robot_name, const std::vector<std::string>& joint_names);
131
137 JointVelocities& operator=(const JointVelocities& velocities) = default;
138
144 JointVelocities& operator+=(const JointVelocities& velocities);
145
151 JointVelocities operator+(const JointVelocities& velocities) const;
152
158 JointVelocities& operator-=(const JointVelocities& velocities);
159
165 JointVelocities operator-(const JointVelocities& velocities) const;
166
172 JointVelocities& operator*=(double lambda);
173
179 JointVelocities operator*(double lambda) const;
180
186 JointVelocities& operator*=(const Eigen::ArrayXd& lambda);
187
193 JointVelocities operator*(const Eigen::ArrayXd& lambda) const;
194
200 JointVelocities& operator*=(const Eigen::MatrixXd& lambda);
201
207 JointVelocities operator*(const Eigen::MatrixXd& lambda) const;
208
214 JointVelocities& operator/=(double lambda);
215
221 JointVelocities operator/(double lambda) const;
222
228 JointAccelerations operator/(const std::chrono::nanoseconds& dt) const;
229
235 JointPositions operator*(const std::chrono::nanoseconds& dt) const;
236
241 JointVelocities copy() const;
242
247 Eigen::VectorXd data() const override;
248
253 virtual void set_data(const Eigen::VectorXd& data) override;
254
259 virtual void set_data(const std::vector<double>& data) override;
260
267 void clamp(double max_absolute_value, double noise_ratio = 0.);
268
276 JointVelocities clamped(double max_absolute_value, double noise_ratio = 0.) const;
277
284 void clamp(const Eigen::ArrayXd& max_absolute_value_array, const Eigen::ArrayXd& noise_ratio_array);
285
294 const Eigen::ArrayXd& max_absolute_value_array, const Eigen::ArrayXd& noise_ratio_array
295 ) const;
296
303 friend std::ostream& operator<<(std::ostream& os, const JointVelocities& velocities);
304
310 friend JointVelocities operator*(double lambda, const JointVelocities& velocities);
311
317 friend JointVelocities operator*(const Eigen::ArrayXd& lambda, const JointVelocities& velocities);
318
324 friend JointVelocities operator*(const Eigen::MatrixXd& lambda, const JointVelocities& velocities);
325
331 friend JointPositions operator*(const std::chrono::nanoseconds& dt, const JointVelocities& velocities);
332};
333}// namespace state_representation
Class to define accelerations of the joints.
Class to define a positions of the joints.
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.
JointVelocities operator+(const JointVelocities &velocities) const
Overload the + operator.
static JointVelocities Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for the random JointVelocities.
Eigen::VectorXd data() const override
Returns the velocities data as an Eigen vector.
friend std::ostream & operator<<(std::ostream &os, const JointVelocities &velocities)
Overload the ostream operator for printing.
static JointVelocities Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for the zero JointVelocities.
JointVelocities & operator/=(double lambda)
Overload the /= operator with a scalar.
friend JointVelocities operator*(double lambda, const JointVelocities &velocities)
Overload the * operator with a scalar.
JointVelocities & operator*=(double lambda)
Overload the *= operator with a double gain.
JointVelocities & operator-=(const JointVelocities &velocities)
Overload the -= operator.
JointVelocities clamped(double max_absolute_value, double noise_ratio=0.) const
Return the velocity clamped to the values in argument.
JointVelocities copy() const
Return a copy of the JointVelocities.
JointVelocities & operator=(const JointVelocities &velocities)=default
Copy assignment operator that have to be defined to the custom assignment operator.
void clamp(double max_absolute_value, double noise_ratio=0.)
Clamp inplace the magnitude of the velocity to the values in argument.
JointVelocities & operator+=(const JointVelocities &velocities)
Overload the += operator.
JointVelocities operator-(const JointVelocities &velocities) const
Overload the - operator.
virtual void set_data(const Eigen::VectorXd &data) override
Set the velocities data from an Eigen vector.
JointVelocities operator/(double lambda) const
Overload the / operator with a scalar.
Core state variables and objects.