1#include "state_representation/space/cartesian/CartesianPose.hpp"
2#include "state_representation/exceptions/EmptyStateException.hpp"
3#include "state_representation/exceptions/IncompatibleSizeException.hpp"
5using namespace state_representation::exceptions;
9 this->
set_type(StateType::CARTESIAN_POSE);
13 this->
set_type(StateType::CARTESIAN_POSE);
18 this->
set_type(StateType::CARTESIAN_POSE);
23 const std::string& name,
double x,
double y,
double z,
const std::string& reference
25 this->
set_type(StateType::CARTESIAN_POSE);
30 const std::string& name,
const Eigen::Quaterniond& orientation,
const std::string& reference
32 this->
set_type(StateType::CARTESIAN_POSE);
37 const std::string& name,
const Eigen::Vector3d& position,
const Eigen::Quaterniond& orientation,
38 const std::string& reference
40 this->
set_type(StateType::CARTESIAN_POSE);
47 this->
set_type(StateType::CARTESIAN_POSE);
62 return CartesianPose(name, Eigen::Vector3d::Random(), Eigen::Quaterniond::UnitRandom(), reference);
138 double period = dt.count();
145 log_q = Eigen::Quaterniond(-log_q.coeffs());
161 if (
data.size() != 7) {
163 "Input is of incorrect size: expected 7, given " + std::to_string(
data.size()));
178 os <<
"Empty CartesianPose";
189 os <<
" <=> theta: " << axis_angle.angle() <<
", ";
190 os <<
"axis: (" << axis_angle.axis()(0) <<
", ";
191 os << axis_angle.axis()(1) <<
", ";
192 os << axis_angle.axis()(2) <<
")";
198 return state.operator*(pose);
202 return pose * lambda;
Class to define acceleration in cartesian space as 3D linear and angular acceleration vectors.
Class to define CartesianPose in cartesian space as 3D position and quaternion based orientation.
void set_data(const Eigen::VectorXd &data) override
Set the pose data from an Eigen vector.
CartesianPose & operator-=(const CartesianPose &pose)
Overload the -= operator.
friend CartesianPose operator*(const CartesianState &state, const CartesianPose &pose)
Overload the * operator with a CartesianState.
CartesianPose()
Empty constructor.
CartesianPose operator-(const CartesianPose &pose) const
Overload the - operator with a pose.
CartesianPose & operator/=(double lambda)
Overload the /= operator with a scalar.
static CartesianPose Identity(const std::string &name, const std::string &reference="world")
Constructor for the identity pose.
CartesianPose & operator+=(const CartesianPose &pose)
Overload the += operator.
Eigen::VectorXd data() const override
Returns the pose data as an Eigen vector.
CartesianPose operator/(double lambda) const
Overload the / operator with a scalar.
CartesianPose copy() const
Return a copy of the CartesianPose.
CartesianPose operator+(const CartesianPose &pose) const
Overload the + operator with a pose.
CartesianPose inverse() const
Compute the inverse of the current CartesianPose.
static CartesianPose Random(const std::string &name, const std::string &reference="world")
Constructor for a random pose.
Class to represent a state in Cartesian space.
void set_zero()
Set the State to a zero value.
CartesianState inverse() const
Compute the inverse of the current CartesianState.
void set_orientation(const Eigen::Quaterniond &orientation)
Setter of the orientation.
const Eigen::Vector3d & get_position() const
Getter of the position attribute.
CartesianState operator-(const CartesianState &state) const
Overload the - operator.
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.
Eigen::Matrix< double, 7, 1 > get_pose() const
Getter of a pose from position and orientation attributes.
void set_position(const Eigen::Vector3d &position)
Setter of the position.
const Eigen::Quaterniond & get_orientation() const
Getter of the orientation attribute.
CartesianState & operator+=(const CartesianState &state)
Overload the += operator.
void set_pose(const Eigen::Vector3d &position, const Eigen::Quaterniond &orientation)
Setter of the pose from both position and orientation.
CartesianState & operator-=(const CartesianState &state)
Overload the -= operator.
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.
void set_linear_velocity(const Eigen::Vector3d &linear_velocity)
Setter of the linear velocity attribute.
void set_angular_velocity(const Eigen::Vector3d &angular_velocity)
Setter of the angular velocity attribute.
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 twist in cartesian space as 3D linear and angular velocity vectors.
Class to define wrench in cartesian space as 3D force and torque vectors.
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)