1#include "state_representation/space/dual_quaternion/DualQuaternionState.hpp"
14 primary(state.primary),
18 const Eigen::Quaterniond& primary,
19 const Eigen::Quaterniond& dual,
20 const std::string& reference) :
28 Eigen::Quaterniond dual =
51 this->primary = Eigen::Quaterniond::Identity();
52 this->dual = Eigen::Quaterniond(0, 0, 0, 0);
57 result.
set_primary(Eigen::Quaterniond(lambda * state.get_primary().coeffs()));
58 result.
set_dual(Eigen::Quaterniond(lambda * state.get_dual().coeffs()));
64 Eigen::Quaterniond pexps;
65 if (state.get_primary().norm() > 1e-5) {
67 coeffs = (sin(state.get_primary().norm()) / state.get_primary().norm()) * state.get_primary().coeffs();
69 pexps = Eigen::Quaterniond(coeffs(3) + cos(state.get_primary().norm()), coeffs(0), coeffs(1), coeffs(2));
71 pexps = Eigen::Quaterniond::Identity();
74 result.
set_dual(state.get_dual() * pexps);
84 if (state.is_empty()) {
85 os <<
"Empty DualQuaternionState";
87 os << state.get_name() <<
" DualQuaternionState expressed in " << state.get_reference_frame() <<
" frame"
89 os <<
"primary: (" << state.primary.w() <<
", ";
90 os << state.primary.x() <<
", ";
91 os << state.primary.y() <<
", ";
92 os << state.primary.z() <<
")" << std::endl;
93 os <<
"dual: (" << state.dual.w() <<
", ";
94 os << state.dual.x() <<
", ";
95 os << state.dual.y() <<
", ";
96 os << state.dual.z() <<
")";
Class to represent a state in Dual Quaternion space.
const Eigen::Quaterniond & get_dual() const
Getter of the dual attribute.
const Eigen::Quaterniond & get_primary() const
Getter of the primary attribute.
void set_primary(const Eigen::Quaterniond &primary)
Setter of the primary attribute.
void set_dual(const Eigen::Quaterniond &dual)
Setter of the dual attribute.
DualQuaternionState & operator*=(const DualQuaternionState &q)
Overload the *= operator.
const DualQuaternionState copy() const
Return a copy of the DualQuaternionState.
virtual void initialize()
Initialize the DualQuaternionState to a zero value.
friend const DualQuaternionState operator*(const float &lambda, const DualQuaternionState &state)
Overload the * operator with a scalar.
DualQuaternionState()
Empty constructor.
const DualQuaternionState conjugate() const
compute the conjugate of the current DualQuaternion
virtual void initialize()
Initialize the State to a zero value.
const std::string & get_name() const
Getter of the name as const reference.
virtual void set_name(const std::string &name)
Setter of the name.
Core state variables and objects.
CartesianAcceleration operator*(const CartesianState &state, const CartesianAcceleration &acceleration)
std::ostream & operator<<(std::ostream &os, const Ellipsoid &ellipsoid)
const DualQuaternionState exp(const DualQuaternionState &state)
StateType
The class types inheriting from State.