1#include "state_representation/space/joint/JointTorques.hpp"
5using namespace exceptions;
8 this->
set_type(StateType::JOINT_TORQUES);
12 this->
set_type(StateType::JOINT_TORQUES);
17 this->
set_type(StateType::JOINT_TORQUES);
23 this->
set_type(StateType::JOINT_TORQUES);
27 const Eigen::VectorXd& torques) :
JointState(robot_name, joint_names) {
28 this->
set_type(StateType::JOINT_TORQUES);
33 this->
set_type(StateType::JOINT_TORQUES);
51 return JointTorques(robot_name, Eigen::VectorXd::Random(nb_joints));
55 return JointTorques(robot_name, joint_names, Eigen::VectorXd::Random(joint_names.size()));
71 this->clamp_state_variable(max_absolute_value, JointStateVariable::TORQUES, noise_ratio);
74void JointTorques::clamp(
const Eigen::ArrayXd& max_absolute_value_array,
const Eigen::ArrayXd& noise_ratio_array) {
75 this->clamp_state_variable(max_absolute_value_array, JointStateVariable::TORQUES, noise_ratio_array);
80 result.
clamp(max_absolute_value, noise_ratio);
85 const Eigen::ArrayXd& noise_ratio_array)
const {
87 result.
clamp(max_absolute_value_array, noise_ratio_array);
Class to define a state in joint space.
const Eigen::VectorXd & get_torques() const
Getter of the torques attribute.
JointState operator+(const JointState &state) const
Add another joint sate.
void multiply_state_variable(const Eigen::MatrixXd &lambda, const JointStateVariable &state_variable_type)
Proxy function that scale the specified state variable by a matrix.
JointState & operator*=(double lambda)
Scale inplace by a scalar.
void set_zero()
Set the joint state to a zero value.
static JointState Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for a zero joint state.
JointState & operator+=(const JointState &state)
Add inplace another joint state.
void set_torques(const Eigen::VectorXd &torques)
Setter of the torques attribute.
std::string to_string() const override
Convert the state to its string representation.
JointState & operator-=(const JointState &state)
Compute inplace the difference with another joint state.
JointState & operator/=(double lambda)
Scale inplace by a scalar.
JointState operator-() const
Negate a joint state.
friend JointState operator*(double lambda, const JointState &state)
Scale a joint state by a scalar.
JointState operator/(double lambda) const
Scale a joint state by a scalar.
Class to define torques of the joints.
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 joint torques.
JointTorques clamped(double max_absolute_value, double noise_ratio=0.) const
Return the torque clamped to the values in argument.
JointTorques()
Empty constructor.
virtual void set_data(const Eigen::VectorXd &data) override
Set the torques data from an Eigen vector.
JointTorques operator-() const
Negate joint torques.
static JointTorques Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for random joint torques.
static JointTorques Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for zero joint torques.
JointTorques & operator/=(double lambda)
Scale inplace by a scalar.
JointTorques operator/(double lambda) const
Scale joint torques by a scalar.
JointTorques & operator*=(double lambda)
Scale inplace by a scalar.
Eigen::VectorXd data() const override
Returns the torques data as an Eigen vector.
friend JointTorques operator*(double lambda, const JointTorques &torques)
Scale joint torques by a scalar.
void set_type(const StateType &type)
Setter of the state type attribute.
Core state variables and objects.
std::ostream & operator<<(std::ostream &os, const AnalogIOState &state)
CartesianAcceleration operator*(double lambda, const CartesianAcceleration &acceleration)