1#include "state_representation/space/cartesian/CartesianWrench.hpp"
3using namespace state_representation::exceptions;
7 this->
set_type(StateType::CARTESIAN_WRENCH);
12 this->
set_type(StateType::CARTESIAN_WRENCH);
17 this->
set_type(StateType::CARTESIAN_WRENCH);
22 const std::string& name,
const Eigen::Vector3d& force,
const Eigen::Vector3d& torque,
const std::string& reference
24 this->
set_type(StateType::CARTESIAN_WRENCH);
30 const std::string& name,
const Eigen::Matrix<double, 6, 1>& wrench,
const std::string& reference
32 this->
set_type(StateType::CARTESIAN_WRENCH);
38 this->
set_type(StateType::CARTESIAN_WRENCH);
53 Eigen::Matrix<double, 6, 1> random = Eigen::Matrix<double, 6, 1>::Random();
93void CartesianWrench::clamp(
double max_force,
double max_torque,
double force_noise_ratio,
double torque_noise_ratio) {
95 this->clamp_state_variable(max_force, CartesianStateVariable::FORCE, force_noise_ratio);
97 this->clamp_state_variable(max_torque, CartesianStateVariable::TORQUE, torque_noise_ratio);
101 double max_force,
double max_torque,
double force_noise_ratio,
double torque_noise_ratio
104 result.
clamp(max_force, max_torque, force_noise_ratio, torque_noise_ratio);
118 if (
data.size() != 6) {
120 "Input is of incorrect size: expected 6, given " + std::to_string(
data.size()));
135 os <<
"Empty CartesianWrench";
139 os <<
"force: (" << wrench.
get_force()(0) <<
", ";
141 os << wrench.
get_force()(2) <<
")" << std::endl;
142 os <<
"torque: (" << wrench.
get_torque()(0) <<
", ";
150 return state.operator*(wrench);
154 return wrench * lambda;
Class to represent a state in Cartesian space.
void set_zero()
Set the State to a zero value.
const Eigen::Vector3d & get_force() const
Getter of the force attribute.
CartesianState inverse() const
Compute the inverse of the current CartesianState.
const Eigen::Vector3d & get_torque() const
Getter of the torque attribute.
CartesianState operator-(const CartesianState &state) const
Overload the - operator.
void set_force(const Eigen::Vector3d &force)
Setter of the force attribute.
static CartesianState Identity(const std::string &name, const std::string &reference="world")
Constructor for the identity CartesianState (identity pose and 0 for the rest)
CartesianState & operator/=(double lambda)
Overload the /= operator with a scalar.
void set_wrench(const Eigen::Matrix< double, 6, 1 > &wrench)
Setter of the force and torque from a 6d wrench vector.
Eigen::Matrix< double, 6, 1 > get_wrench() const
Getter of the 6d wrench from force and torque attributes.
CartesianState & operator+=(const CartesianState &state)
Overload the += operator.
CartesianState & operator-=(const CartesianState &state)
Overload the -= operator.
void set_torque(const Eigen::Vector3d &torque)
Setter of the torque attribute.
CartesianState & operator*=(const CartesianState &state)
Overload the *= operator with another state by deriving the equations of motions.
CartesianState operator/(double lambda) const
Overload the / operator with a scalar.
friend CartesianState operator*(double lambda, const CartesianState &state)
Overload the * operator with a scalar.
CartesianState operator+(const CartesianState &state) const
Overload the + operator.
Class to define wrench in cartesian space as 3D force and torque vectors.
CartesianWrench & operator+=(const CartesianWrench &wrench)
Overload the += operator.
CartesianWrench & operator-=(const CartesianWrench &wrench)
Overload the -= operator.
Eigen::VectorXd data() const override
Returns the wrench data as an Eigen vector.
CartesianWrench()
Empty constructor.
CartesianWrench operator/(double lambda) const
Overload the / operator with a scalar.
static CartesianWrench Zero(const std::string &name, const std::string &reference="world")
Constructor for the zero wrench.
void set_data(const Eigen::VectorXd &data) override
Set the wrench data from an Eigen vector.
friend CartesianWrench operator*(const CartesianState &state, const CartesianWrench &wrench)
Overload the * operator with a CartesianState.
CartesianWrench clamped(double max_force, double max_torque, double force_noise_ratio=0, double torque_noise_ratio=0) const
Return the clamped wrench.
CartesianWrench operator-(const CartesianWrench &wrench) const
Overload the - operator.
CartesianWrench copy() const
Return a copy of the CartesianWrench.
CartesianWrench inverse() const
Compute the inverse of the current CartesianWrench.
CartesianWrench operator+(const CartesianWrench &wrench) const
Overload the + operator.
void clamp(double max_force, double max_torque, double force_noise_ratio=0, double torque_noise_ratio=0)
Clamp inplace the magnitude of the wrench to the values in argument.
CartesianWrench & operator/=(double lambda)
Overload the /= operator with a scalar.
static CartesianWrench Random(const std::string &name, const std::string &reference="world")
Constructor for a random wrench.
const std::string & get_reference_frame() const
Getter of the reference frame as const reference.
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)