1#include "state_representation/space/joint/JointAccelerations.hpp"
2#include "state_representation/exceptions/EmptyStateException.hpp"
4using namespace state_representation::exceptions;
8 this->
set_type(StateType::JOINT_ACCELERATIONS);
13 this->
set_type(StateType::JOINT_ACCELERATIONS);
18 this->
set_type(StateType::JOINT_ACCELERATIONS);
24 this->
set_type(StateType::JOINT_ACCELERATIONS);}
27 const std::vector<std::string>& joint_names,
28 const Eigen::VectorXd& accelerations) :
JointState(robot_name, joint_names) {
29 this->
set_type(StateType::JOINT_ACCELERATIONS);
35 this->
set_type(StateType::JOINT_ACCELERATIONS);
62 return JointAccelerations(robot_name, joint_names, Eigen::VectorXd::Random(joint_names.size()));
128 double period = dt.count();
153 this->clamp_state_variable(max_absolute_value, JointStateVariable::ACCELERATIONS, noise_ratio);
158 result.
clamp(max_absolute_value, noise_ratio);
164 this->clamp_state_variable(max_absolute_value_array, JointStateVariable::ACCELERATIONS, noise_ratio_array);
168 const Eigen::ArrayXd& noise_ratio_array)
const {
170 result.
clamp(max_absolute_value_array, noise_ratio_array);
176 os <<
"Empty JointAccelerations";
178 os << accelerations.
get_name() <<
" JointAccelerations" << std::endl;
180 for (
auto& n : accelerations.
get_names()) { os << n <<
", "; }
181 os <<
"]" << std::endl;
182 os <<
"accelerations: [";
208 return accelerations * dt;
Class to define accelerations of the joints.
JointAccelerations copy() const
Return a copy of the JointAccelerations.
JointAccelerations & operator-=(const JointAccelerations &accelerations)
Overload the -= operator.
JointAccelerations()
Empty constructor.
JointAccelerations & operator+=(const JointAccelerations &accelerations)
Overload the += operator.
JointAccelerations operator+(const JointAccelerations &accelerations) const
Overload the + operator.
Eigen::VectorXd data() const override
Returns the accelerations data as an Eigen vector.
JointAccelerations clamped(double max_absolute_value, double noise_ratio=0.) const
Return the acceleration clamped to the values in argument.
JointAccelerations & operator/=(double lambda)
Overload the /= operator with a scalar.
JointAccelerations operator-(const JointAccelerations &accelerations) const
Overload the - operator.
friend JointAccelerations operator*(double lambda, const JointAccelerations &accelerations)
Overload the * operator with a scalar.
virtual void set_data(const Eigen::VectorXd &data) override
Set the accelerations data from an Eigen vector.
static JointAccelerations Zero(const std::string &robot_name, unsigned int nb_joints)
Constructor for the zero JointAccelerations.
void clamp(double max_absolute_value, double noise_ratio=0.)
Clamp inplace the magnitude of the acceleration to the values in argument.
JointAccelerations operator/(double lambda) const
Overload the / operator with a scalar.
JointAccelerations & operator*=(double lambda)
Overload the *= operator with a double gain.
static JointAccelerations Random(const std::string &robot_name, unsigned int nb_joints)
Constructor for the random JointAccelerations.
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.
JointState & operator*=(double lambda)
Overload the *= operator with a double gain.
void set_zero()
Set the JointState to a zero value.
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.
const Eigen::VectorXd & get_accelerations() const
Getter of the accelerations attribute.
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.
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)