1#include "state_representation/space/joint/JointVelocities.hpp"
2#include "state_representation/exceptions/EmptyStateException.hpp"
4using namespace state_representation::exceptions;
8 this->
set_type(StateType::JOINT_VELOCITIES);
13 this->
set_type(StateType::JOINT_VELOCITIES);
18 this->
set_type(StateType::JOINT_VELOCITIES);
24 this->
set_type(StateType::JOINT_VELOCITIES);
28 const std::string& robot_name,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& velocities
30 this->
set_type(StateType::JOINT_VELOCITIES);
36 this->
set_type(StateType::JOINT_VELOCITIES);
64 return JointVelocities(robot_name, joint_names, Eigen::VectorXd::Random(joint_names.size()));
130 double period = dt.count();
134 return accelerations;
142 double period = dt.count();
167 this->clamp_state_variable(max_absolute_value, JointStateVariable::VELOCITIES, noise_ratio);
172 result.
clamp(max_absolute_value, noise_ratio);
177 this->clamp_state_variable(max_absolute_value_array, JointStateVariable::VELOCITIES, noise_ratio_array);
181 const Eigen::ArrayXd& max_absolute_value_array,
const Eigen::ArrayXd& noise_ratio_array
184 result.
clamp(max_absolute_value_array, noise_ratio_array);
190 os <<
"Empty JointVelocities";
192 os << velocities.
get_name() <<
" JointVelocities" << std::endl;
194 for (
auto& n: velocities.
get_names()) { os << n <<
", "; }
195 os <<
"]" << std::endl;
196 os <<
"velocities: [";
197 for (
unsigned int i = 0; i < velocities.
get_size(); ++i) { os << velocities.
get_velocities()(i) <<
", "; }
222 return velocities * dt;
Class to define accelerations of the joints.
Class to define a positions of the joints.
Class to define a state in joint space.
JointState operator+(const JointState &state) const
Overload the + operator.
void set_accelerations(const Eigen::VectorXd &accelerations)
Setter of the accelerations attribute.
void set_positions(const Eigen::VectorXd &positions)
Setter of the positions attribute.
JointState & operator*=(double lambda)
Overload the *= operator with a double gain.
void set_zero()
Set the JointState to a zero value.
const Eigen::VectorXd & get_velocities() const
Getter of the velocities attribute.
unsigned int get_size() const
Getter of the size from the attributes.
JointState operator-(const JointState &state) const
Overload the - operator.
static JointState Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for a zero JointState.
JointState & operator+=(const JointState &state)
Overload the += operator.
JointState & operator-=(const JointState &state)
Overload the -= operator.
void multiply_state_variable(const Eigen::ArrayXd &lambda, const JointStateVariable &state_variable_type)
Proxy function that multiply the specified state variable by an array of gain.
JointState & operator/=(double lambda)
Overload the /= operator with a scalar.
friend JointState operator*(double lambda, const JointState &state)
Overload the * operator with a scalar.
const std::vector< std::string > & get_names() const
Getter of the names attribute.
void set_velocities(const Eigen::VectorXd &velocities)
Setter of the velocities attribute.
JointState operator/(double lambda) const
Overload the / operator with a scalar.
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.
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()
Empty constructor.
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.
const std::string & get_name() const
Getter of the name as const reference.
void set_type(const StateType &type)
Override the state type.
bool is_empty() const
Getter of the empty attribute.
void set_empty(bool empty=true)
Setter of the empty attribute.
Core state variables and objects.
CartesianAcceleration operator*(const CartesianState &state, const CartesianAcceleration &acceleration)
std::ostream & operator<<(std::ostream &os, const Ellipsoid &ellipsoid)