Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
joint_state.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_COMMON_JOINT_STATE_H
27#define TESSERACT_COMMON_JOINT_STATE_H
28
31#include <Eigen/Dense>
32#include <vector>
33#include <boost/serialization/base_object.hpp>
35
36namespace tesseract_common
37{
39{
40public:
41 JointState() = default;
42 JointState(std::vector<std::string> joint_names, const Eigen::Ref<const Eigen::VectorXd>& position);
43
45 std::vector<std::string> joint_names;
46
48 Eigen::VectorXd position;
49
51 Eigen::VectorXd velocity;
52
54 Eigen::VectorXd acceleration;
55
57 Eigen::VectorXd effort;
58
60 double time{ 0 };
61
62 bool operator==(const JointState& other) const;
63
64 bool operator!=(const JointState& rhs) const;
65
66private:
68 template <class Archive>
69 void serialize(Archive& ar, const unsigned int version); // NOLINT
70};
71
72} // namespace tesseract_common
73
74namespace tesseract_common
75{
78{
79public:
80 JointTrajectory(std::string description = "");
81 JointTrajectory(std::vector<JointState> states, std::string description = "");
82
83 std::vector<JointState> states;
84 std::string description;
85
86 bool operator==(const JointTrajectory& other) const;
87
88 bool operator!=(const JointTrajectory& rhs) const;
89
91 // C++ container support //
93
97 using pointer = typename std::vector<value_type>::pointer;
99 using const_pointer = typename std::vector<value_type>::const_pointer;
101 using reference = typename std::vector<value_type>::reference;
103 using const_reference = typename std::vector<value_type>::const_reference;
105 using size_type = typename std::vector<value_type>::size_type;
107 using difference_type = typename std::vector<value_type>::difference_type;
109 using iterator = typename std::vector<value_type>::iterator;
111 using const_iterator = typename std::vector<value_type>::const_iterator;
113 using reverse_iterator = typename std::vector<value_type>::reverse_iterator;
115 using const_reverse_iterator = typename std::vector<value_type>::const_reverse_iterator;
116
117 template <class InputIt>
118 JointTrajectory(InputIt first, InputIt last) : states(first, last)
119 {
120 }
121
123 // Iterators //
125
126 iterator begin();
128 const_iterator begin() const;
130 iterator end();
132 const_iterator end() const;
142 const_iterator cbegin() const;
144 const_iterator cend() const;
149
151 // Capacity //
153
154 bool empty() const;
156 size_type size() const;
158 size_type max_size() const;
160 void reserve(size_type n);
162 size_type capacity() const;
164 void shrink_to_fit();
165
167 // Element Access //
169
172 const_reference front() const;
174 reference back();
176 const_reference back() const;
182 pointer data();
184 const_pointer data() const;
189
191 // Modifiers //
193
194 void clear();
198 iterator insert(const_iterator p, std::initializer_list<value_type> l);
199 template <class InputIt>
200 void insert(const_iterator pos, InputIt first, InputIt last)
201 {
202 states.insert(pos, first, last);
203 }
204
206 template <class... Args>
207 iterator emplace(const_iterator pos, Args&&... args);
208
213 void push_back(const value_type& x);
214 void push_back(const value_type&& x);
215
217 template <typename... Args>
218#if __cplusplus > 201402L
219 reference emplace_back(Args&&... args);
220#else
221 void emplace_back(Args&&... args);
222#endif
223
225 void pop_back();
227 void swap(std::vector<value_type>& other);
228
229private:
231 template <class Archive>
232 void serialize(Archive& ar, const unsigned int version); // NOLINT
233};
234
235} // namespace tesseract_common
236
237#endif // TESSERACT_COMMON_JOINT_STATE_H
Definition: joint_state.h:39
std::vector< std::string > joint_names
The joint corresponding to the position vector.
Definition: joint_state.h:45
void serialize(Archive &ar, const unsigned int version)
Definition: joint_state.cpp:59
Eigen::VectorXd effort
The Effort at the waypoint (optional)
Definition: joint_state.h:57
double time
The Time from start at the waypoint (optional)
Definition: joint_state.h:60
Eigen::VectorXd acceleration
The Acceleration at the waypoint (optional)
Definition: joint_state.h:54
bool operator!=(const JointState &rhs) const
Definition: joint_state.cpp:56
bool operator==(const JointState &other) const
Definition: joint_state.cpp:44
Eigen::VectorXd position
The joint position at the waypoint.
Definition: joint_state.h:48
friend class boost::serialization::access
Definition: joint_state.h:67
Eigen::VectorXd velocity
The velocity at the waypoint (optional)
Definition: joint_state.h:51
Represents a joint trajectory.
Definition: joint_state.h:78
void swap(std::vector< value_type > &other)
swaps the contents
Definition: joint_state.cpp:165
const_iterator cend() const
returns an iterator to the end
Definition: joint_state.cpp:98
const_iterator cbegin() const
returns an iterator to the beginning
Definition: joint_state.cpp:97
typename std::vector< value_type >::reference reference
Definition: joint_state.h:101
iterator insert(const_iterator p, const value_type &x)
inserts element
Definition: joint_state.cpp:130
typename std::vector< value_type >::iterator iterator
Definition: joint_state.h:109
void emplace_back(Args &&... args)
constructs an element in-place at the end
Definition: joint_state.cpp:158
void insert(const_iterator pos, InputIt first, InputIt last)
Definition: joint_state.h:200
reference operator[](size_type pos)
access specified element
Definition: joint_state.cpp:123
size_type size() const
returns the number of elements
Definition: joint_state.cpp:106
void push_back(const value_type &x)
adds an element to the end
Definition: joint_state.cpp:148
size_type capacity() const
returns the number of elements that can be held in currently allocated storage
Definition: joint_state.cpp:109
reference front()
access the first element
Definition: joint_state.cpp:115
reverse_iterator rend()
returns a reverse iterator to the end
Definition: joint_state.cpp:95
bool empty() const
checks whether the container is empty
Definition: joint_state.cpp:105
typename std::vector< value_type >::pointer pointer
Definition: joint_state.h:97
reference back()
access the last element
Definition: joint_state.cpp:117
void clear()
clears the contents
Definition: joint_state.cpp:129
std::string description
Definition: joint_state.h:84
void reserve(size_type n)
reserve number of elements
Definition: joint_state.cpp:108
JointTrajectory(InputIt first, InputIt last)
Definition: joint_state.h:118
void serialize(Archive &ar, const unsigned int version)
Definition: joint_state.cpp:168
reference at(size_type n)
access specified element with bounds checking
Definition: joint_state.cpp:119
typename std::vector< value_type >::const_iterator const_iterator
Definition: joint_state.h:111
typename std::vector< value_type >::const_reverse_iterator const_reverse_iterator
Definition: joint_state.h:115
const_reverse_iterator crbegin() const
returns a reverse iterator to the beginning
Definition: joint_state.cpp:99
iterator emplace(const_iterator pos, Args &&... args)
constructs element in-place
Definition: joint_state.cpp:138
const_reverse_iterator crend() const
returns a reverse iterator to the end
Definition: joint_state.cpp:100
void pop_back()
removes the last element
Definition: joint_state.cpp:164
iterator begin()
returns an iterator to the beginning
Definition: joint_state.cpp:89
size_type max_size() const
returns the maximum possible number of elements
Definition: joint_state.cpp:107
iterator end()
returns an iterator to the end
Definition: joint_state.cpp:91
iterator erase(const_iterator p)
erases element
Definition: joint_state.cpp:143
bool operator!=(const JointTrajectory &rhs) const
Definition: joint_state.cpp:84
typename std::vector< value_type >::size_type size_type
Definition: joint_state.h:105
friend class boost::serialization::access
Definition: joint_state.h:230
JointState value_type
Definition: joint_state.h:95
std::vector< JointState > states
Definition: joint_state.h:83
typename std::vector< value_type >::const_pointer const_pointer
Definition: joint_state.h:99
bool operator==(const JointTrajectory &other) const
Definition: joint_state.cpp:76
void shrink_to_fit()
reduces memory usage by freeing unused memory
Definition: joint_state.cpp:110
typename std::vector< value_type >::difference_type difference_type
Definition: joint_state.h:107
typename std::vector< value_type >::const_reference const_reference
Definition: joint_state.h:103
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition: joint_state.cpp:93
typename std::vector< value_type >::reverse_iterator reverse_iterator
Definition: joint_state.h:113
pointer data()
direct access to the underlying array
Definition: joint_state.cpp:121
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: allowed_collision_matrix.h:16