Control Libraries 7.4.0
Loading...
Searching...
No Matches
DualQuaternionTwist.hpp
1#pragma once
2
3#include "state_representation/space/dual_quaternion/DualQuaternionState.hpp"
4
5namespace state_representation {
11private:
12 Eigen::Vector3d position;
13 Eigen::Vector3d linear_velocity;
14
15public:
21 explicit DualQuaternionTwist(const std::string& name, const std::string& reference = "world");
22
27
31 explicit DualQuaternionTwist(const std::string& name,
32 const Eigen::Vector3d& linear_velocity,
33 const Eigen::Vector3d& angular_velocity,
34 const Eigen::Vector3d& position,
35 const std::string& reference);
36
40 const Eigen::Vector3d& get_position() const;
41
45 const Eigen::Vector3d& get_linear_velocity() const;
46
50 const Eigen::Vector3d get_angular_velocity() const;
51
55 void set_linear_velocity(const Eigen::Vector3d& linear_velocity);
56
60 void set_angular_velocity(const Eigen::Vector3d& angular_velocity);
61
65 void set_position(const Eigen::Vector3d& position);
66
71 void operator=(const DualQuaternionState& q);
72
76 void initialize();
77
82 const DualQuaternionTwist copy() const;
83
90 friend std::ostream& operator<<(std::ostream& os, const DualQuaternionTwist& state);
91};
92
93inline const Eigen::Vector3d& DualQuaternionTwist::get_position() const {
94 return this->position;
95}
96
97inline const Eigen::Vector3d& DualQuaternionTwist::get_linear_velocity() const {
98 return this->linear_velocity;
99}
100
101inline const Eigen::Vector3d DualQuaternionTwist::get_angular_velocity() const {
102 return this->get_primary().vec();
103}
104
105inline void DualQuaternionTwist::set_linear_velocity(const Eigen::Vector3d& linear_velocity) {
106 this->linear_velocity = linear_velocity;
107 Eigen::Vector3d temp = this->get_linear_velocity() + this->get_position().cross(this->get_angular_velocity());
108 this->set_dual(Eigen::Quaterniond(0, temp(0), temp(1), temp(2)));
109}
110
111inline void DualQuaternionTwist::set_angular_velocity(const Eigen::Vector3d& angular_velocity) {
112 this->set_primary(Eigen::Quaterniond(0, angular_velocity(0), angular_velocity(1), angular_velocity(2)));
113 Eigen::Vector3d temp = this->get_linear_velocity() + this->get_position().cross(this->get_angular_velocity());
114 this->set_dual(Eigen::Quaterniond(0, temp(0), temp(1), temp(2)));
115}
116
117inline void DualQuaternionTwist::set_position(const Eigen::Vector3d& position) {
118 this->position = position;
119 Eigen::Vector3d temp = this->get_linear_velocity() + this->get_position().cross(this->get_angular_velocity());
120 this->set_dual(Eigen::Quaterniond(0, temp(0), temp(1), temp(2)));
121}
122}
Class to represent a state in Dual Quaternion space.
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.
Class to represent a Twist in Dual Quaternion space.
void set_position(const Eigen::Vector3d &position)
Setter of the position.
friend std::ostream & operator<<(std::ostream &os, const DualQuaternionTwist &state)
Overload the ostream operator for printing.
void initialize()
Initialize the DualQuaternionPose to a zero value.
const Eigen::Vector3d & get_linear_velocity() const
Getter of the linear_velocity attribute.
void set_angular_velocity(const Eigen::Vector3d &angular_velocity)
Setter of the angular_velocity.
void operator=(const DualQuaternionState &q)
Overload the = operator to create a twist from a DualQuaternionState. Note that the linear velocity w...
const Eigen::Vector3d & get_position() const
Getter of the position attribute.
void set_linear_velocity(const Eigen::Vector3d &linear_velocity)
Setter of the linear_velocity.
const DualQuaternionTwist copy() const
Return a copy of the DualQuaternionTwist.
const Eigen::Vector3d get_angular_velocity() const
Getter of the angular_velocity attribute.
Core state variables and objects.