Control Libraries 7.4.0
Loading...
Searching...
No Matches
Shape.hpp
1#pragma once
2
3#include "state_representation/State.hpp"
4#include "state_representation/space/cartesian/CartesianState.hpp"
5#include "state_representation/space/cartesian/CartesianPose.hpp"
6#include "state_representation/space/cartesian/CartesianTwist.hpp"
7
8namespace state_representation {
12class Shape : public State {
13public:
17 Shape();
18
24 explicit Shape(const std::string& name, const std::string& reference_frame = "world");
25
30 Shape(const Shape& shape);
31
37 static Shape Unit(const std::string& name, const std::string& reference_frame = "world");
38
44 friend void swap(Shape& state1, Shape& state2);
45
51 Shape& operator=(const Shape& state);
52
57 const CartesianState& get_center_state() const;
58
63 const CartesianPose& get_center_pose() const;
64
69 const Eigen::Vector3d get_center_position() const;
70
75 const Eigen::Quaterniond get_center_orientation() const;
76
81 const CartesianTwist& get_center_twist() const;
82
87 void set_center_state(const CartesianState& state);
88
93 void set_center_pose(const CartesianPose& pose);
94
99 void set_center_position(const Eigen::Vector3d& position);
100
105 void set_center_orientation(const Eigen::Quaterniond& orientation);
106
113 friend std::ostream& operator<<(std::ostream& os, const Shape& shape);
114
115protected:
119 std::string to_string() const override;
120
121private:
122 CartesianState center_state_;
123};
124
125inline void swap(Shape& state1, Shape& state2) {
126 swap(static_cast<State&>(state1), static_cast<State&>(state2));
127 std::swap(state1.center_state_, state2.center_state_);
128}
129}// namespace state_representation
Class to define Cartesian pose in Cartesian space as 3D position and quaternion based orientation.
Class to represent a state in Cartesian space.
Class to define twist in Cartesian space as 3D linear and angular velocity vectors.
void set_center_orientation(const Eigen::Quaterniond &orientation)
Setter of the pose.
Definition Shape.cpp:82
void set_center_state(const CartesianState &state)
Setter of the state.
Definition Shape.cpp:60
friend void swap(Shape &state1, Shape &state2)
Swap the values of the two Shapes.
Definition Shape.hpp:125
Shape & operator=(const Shape &state)
Copy assignment operator that has to be defined to the custom assignment operator.
Definition Shape.cpp:29
static Shape Unit(const std::string &name, const std::string &reference_frame="world")
Constructor for a Shape with identity state.
Definition Shape.cpp:23
Shape()
Empty constructor.
Definition Shape.cpp:8
const Eigen::Vector3d get_center_position() const
Getter of the position from the state.
Definition Shape.cpp:45
std::string to_string() const override
Convert the state to its string representation.
Definition Shape.cpp:87
const CartesianState & get_center_state() const
Getter of the state.
Definition Shape.cpp:35
friend std::ostream & operator<<(std::ostream &os, const Shape &shape)
Overload the ostream operator for printing.
Definition Shape.cpp:98
const CartesianPose & get_center_pose() const
Getter of the pose from the state.
Definition Shape.cpp:40
const Eigen::Quaterniond get_center_orientation() const
Getter of the orientation from the state.
Definition Shape.cpp:50
void set_center_pose(const CartesianPose &pose)
Setter of the pose.
Definition Shape.cpp:68
void set_center_position(const Eigen::Vector3d &position)
Setter of the position.
Definition Shape.cpp:77
const CartesianTwist & get_center_twist() const
Getter of the twist from the state.
Definition Shape.cpp:55
Abstract class to represent a state.
Definition State.hpp:25
Core state variables and objects.
void swap(AnalogIOState &state1, AnalogIOState &state2)