1#include "state_representation/space/joint/JointVelocities.hpp"
2#include "state_representation/exceptions/EmptyStateException.hpp"
6using namespace exceptions;
9 this->
set_type(StateType::JOINT_VELOCITIES);
14 this->
set_type(StateType::JOINT_VELOCITIES);
19 this->
set_type(StateType::JOINT_VELOCITIES);
25 this->
set_type(StateType::JOINT_VELOCITIES);
29 const std::string& robot_name,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& velocities
31 this->
set_type(StateType::JOINT_VELOCITIES);
36 this->
set_type(StateType::JOINT_VELOCITIES);
65 return JointVelocities(robot_name, joint_names, Eigen::VectorXd::Random(joint_names.size()));
81 this->clamp_state_variable(max_absolute_value, JointStateVariable::VELOCITIES, noise_ratio);
84void JointVelocities::clamp(
const Eigen::ArrayXd& max_absolute_value_array,
const Eigen::ArrayXd& noise_ratio_array) {
85 this->clamp_state_variable(max_absolute_value_array, JointStateVariable::VELOCITIES, noise_ratio_array);
90 result.
clamp(max_absolute_value, noise_ratio);
95 const Eigen::ArrayXd& max_absolute_value_array,
const Eigen::ArrayXd& noise_ratio_array
98 result.
clamp(max_absolute_value_array, noise_ratio_array);
132 double period = dt.count();
140 return velocities * dt;
156 double period = dt.count();
160 return accelerations;
Class to define accelerations of the joints.
Class to define positions of the joints.
Class to define a state in joint space.
JointState operator+(const JointState &state) const
Add another joint sate.
void set_accelerations(const Eigen::VectorXd &accelerations)
Setter of the accelerations attribute.
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.
const Eigen::VectorXd & get_velocities() const
Getter of the velocities attribute.
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.
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.
static JointVelocities Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for random joint velocities.
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 zero joint velocities.
JointVelocities operator-() const
Negate joint velocities.
JointVelocities & operator/=(double lambda)
Scale inplace by a scalar.
friend JointVelocities operator*(double lambda, const JointVelocities &velocities)
Scale joint velocities by a scalar.
JointVelocities & operator*=(double lambda)
Scale inplace by a scalar.
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 joint velocities.
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.
virtual void set_data(const Eigen::VectorXd &data) override
Set the velocities data from an Eigen vector.
JointVelocities operator/(double lambda) const
Scale joint velocities by a scalar.
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)