1#include "state_representation/space/joint/JointPositions.hpp"
3#include "state_representation/exceptions/EmptyStateException.hpp"
7using namespace exceptions;
10 this->
set_type(StateType::JOINT_POSITIONS);
15 this->
set_type(StateType::JOINT_POSITIONS);
20 this->
set_type(StateType::JOINT_POSITIONS);
26 this->
set_type(StateType::JOINT_POSITIONS);
30 const std::string& robot_name,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& positions
32 this->
set_type(StateType::JOINT_POSITIONS);
37 this->
set_type(StateType::JOINT_POSITIONS);
59 return JointPositions(robot_name, Eigen::VectorXd::Random(nb_joints));
63 return JointPositions(robot_name, joint_names, Eigen::VectorXd::Random(joint_names.size()));
79 this->clamp_state_variable(max_absolute_value, JointStateVariable::POSITIONS, noise_ratio);
82void JointPositions::clamp(
const Eigen::ArrayXd& max_absolute_value_array,
const Eigen::ArrayXd& noise_ratio_array) {
83 this->clamp_state_variable(max_absolute_value_array, JointStateVariable::POSITIONS, noise_ratio_array);
88 result.
clamp(max_absolute_value, noise_ratio);
93 const Eigen::ArrayXd& max_absolute_value_array,
const Eigen::ArrayXd& noise_ratio_array
96 result.
clamp(max_absolute_value_array, noise_ratio_array);
139 double period = dt.count();
Class to define positions of the joints.
void clamp(double max_absolute_value, double noise_ratio=0.)
Clamp inplace the magnitude of the positions to the value in argument.
static JointPositions Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for zero joint positions.
Eigen::VectorXd data() const override
Returns the positions data as an Eigen vector.
JointPositions & operator*=(double lambda)
Scale inplace by a scalar.
JointPositions operator-() const
Negate joint positions.
virtual void set_data(const Eigen::VectorXd &data) override
Set the positions data from an Eigen vector.
JointPositions operator/(double lambda) const
Scale joint positions by a scalar.
JointPositions clamped(double max_absolute_value, double noise_ratio=0.) const
Return the position clamped to the value in argument.
static JointPositions Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for random joint positions.
friend JointPositions operator*(double lambda, const JointPositions &positions)
Scale joint positions by a scalar.
JointPositions copy() const
Return a copy of the joint positions.
JointPositions()
Empty constructor.
JointPositions & operator/=(double lambda)
Scale inplace by a scalar.
Class to define a state in joint space.
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.
void set_positions(const Eigen::VectorXd &positions)
Setter of the positions attribute.
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.
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.
const std::vector< std::string > & get_names() const
Getter of the names attribute.
const Eigen::VectorXd & get_positions() const
Getter of the positions attribute.
void set_velocities(const Eigen::VectorXd &velocities)
Setter of the velocities attribute.
JointState operator/(double lambda) const
Scale a joint state by a scalar.
Class to define velocities of the joints.
const std::string & get_name() const
Getter of the name attribute.
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)