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 <boost/serialization/export.hpp>
32 #include <boost/serialization/version.hpp>
33 #include <boost/uuid/uuid.hpp>
34 #include <Eigen/Core>
35 #include <vector>
37 
39 
40 namespace boost::serialization
41 {
42 class access;
43 }
44 
45 namespace tesseract_common
46 {
47 struct Serialization;
48 
50 {
51 public:
52  JointState() = default;
53  JointState(std::vector<std::string> joint_names, const Eigen::Ref<const Eigen::VectorXd>& position);
54 
56  std::vector<std::string> joint_names;
57 
59  Eigen::VectorXd position;
60 
62  Eigen::VectorXd velocity;
63 
65  Eigen::VectorXd acceleration;
66 
68  Eigen::VectorXd effort;
69 
71  double time{ 0 };
72 
73  bool operator==(const JointState& other) const;
74 
75  bool operator!=(const JointState& rhs) const;
76 
77 private:
80  template <class Archive>
81  void serialize(Archive& ar, const unsigned int version); // NOLINT
82 };
83 
86 {
87 public:
88  JointTrajectory(std::string description = "");
89  JointTrajectory(std::vector<JointState> states, std::string description = "");
90 
91  boost::uuids::uuid uuid{};
92  std::vector<JointState> states;
93  std::string description;
94 
95  bool operator==(const JointTrajectory& other) const;
96 
97  bool operator!=(const JointTrajectory& rhs) const;
98 
100  // C++ container support //
102 
106  using pointer = typename std::vector<value_type>::pointer;
108  using const_pointer = typename std::vector<value_type>::const_pointer;
110  using reference = typename std::vector<value_type>::reference;
112  using const_reference = typename std::vector<value_type>::const_reference;
114  using size_type = typename std::vector<value_type>::size_type;
116  using difference_type = typename std::vector<value_type>::difference_type;
118  using iterator = typename std::vector<value_type>::iterator;
120  using const_iterator = typename std::vector<value_type>::const_iterator;
122  using reverse_iterator = typename std::vector<value_type>::reverse_iterator;
124  using const_reverse_iterator = typename std::vector<value_type>::const_reverse_iterator;
125 
126  template <class InputIt>
127  JointTrajectory(InputIt first, InputIt last) : states(first, last)
128  {
129  }
130 
132  // Iterators //
134 
135  iterator begin();
137  const_iterator begin() const;
139  iterator end();
141  const_iterator end() const;
151  const_iterator cbegin() const;
153  const_iterator cend() const;
158 
160  // Capacity //
162 
163  bool empty() const;
165  size_type size() const;
167  size_type max_size() const;
169  void reserve(size_type n);
171  size_type capacity() const;
173  void shrink_to_fit();
174 
176  // Element Access //
178 
179  reference front();
181  const_reference front() const;
183  reference back();
185  const_reference back() const;
189  const_reference at(size_type n) const;
191  pointer data();
193  const_pointer data() const;
198 
200  // Modifiers //
202 
203  void clear();
207  iterator insert(const_iterator p, std::initializer_list<value_type> l);
208  template <class InputIt>
209  void insert(const_iterator pos, InputIt first, InputIt last)
210  {
211  states.insert(pos, first, last);
212  }
213 
215  template <class... Args>
216  iterator emplace(const_iterator pos, Args&&... args);
217 
222  void push_back(const value_type& x);
223  void push_back(const value_type&& x);
224 
226  template <typename... Args>
227 #if __cplusplus > 201402L
228  reference emplace_back(Args&&... args);
229 #else
230  void emplace_back(Args&&... args);
231 #endif
232 
234  void pop_back();
236  void swap(std::vector<value_type>& other) noexcept;
237 
238 private:
241  template <class Archive>
242  void serialize(Archive& ar, const unsigned int version); // NOLINT
243 };
244 
247 } // namespace tesseract_common
248 
249 BOOST_CLASS_EXPORT_KEY(tesseract_common::JointState)
250 BOOST_CLASS_EXPORT_KEY(tesseract_common::JointTrajectory)
251 BOOST_CLASS_EXPORT_KEY(tesseract_common::JointStateAnyPoly)
252 BOOST_CLASS_EXPORT_KEY(tesseract_common::JointStatePtrAnyPoly)
253 #endif // TESSERACT_COMMON_JOINT_STATE_H
tesseract_common::JointTrajectory::empty
bool empty() const
checks whether the container is empty
Definition: joint_state.cpp:112
tesseract_common::JointTrajectory::operator==
bool operator==(const JointTrajectory &other) const
Definition: joint_state.cpp:80
tesseract_common::JointTrajectory::max_size
size_type max_size() const
returns the maximum possible number of elements
Definition: joint_state.cpp:114
tesseract_common::JointTrajectory::at
reference at(size_type n)
access specified element with bounds checking
Definition: joint_state.cpp:126
tesseract_common
Definition: allowed_collision_matrix.h:19
tesseract_common::JointTrajectory::reference
typename std::vector< value_type >::reference reference
Definition: joint_state.h:110
tesseract_common::JointState::JointState
JointState()=default
tesseract_common::JointTrajectory::iterator
typename std::vector< value_type >::iterator iterator
Definition: joint_state.h:118
tesseract_common::JointState::effort
Eigen::VectorXd effort
The Effort at the waypoint (optional)
Definition: joint_state.h:68
any_poly.h
tesseract_common::JointTrajectory::description
std::string description
Definition: joint_state.h:93
tesseract_common::JointTrajectory::back
reference back()
access the last element
Definition: joint_state.cpp:124
tesseract_common::JointTrajectory::cend
const_iterator cend() const
returns an iterator to the end
Definition: joint_state.cpp:105
tesseract_common::JointState::velocity
Eigen::VectorXd velocity
The velocity at the waypoint (optional)
Definition: joint_state.h:62
tesseract_common::JointTrajectory::front
reference front()
access the first element
Definition: joint_state.cpp:122
tesseract_common::JointTrajectory::rend
reverse_iterator rend()
returns a reverse iterator to the end
Definition: joint_state.cpp:102
macros.h
Common Tesseract Macros.
tesseract_common::JointTrajectory::insert
iterator insert(const_iterator p, const value_type &x)
inserts element
Definition: joint_state.cpp:137
tesseract_common::JointTrajectory::clear
void clear()
clears the contents
Definition: joint_state.cpp:136
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
tesseract_common::JointTrajectory::pointer
typename std::vector< value_type >::pointer pointer
Definition: joint_state.h:106
tesseract_common::AnyWrapper
Definition: any_poly.h:80
tesseract_common::JointTrajectory::rbegin
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition: joint_state.cpp:100
tesseract_common::Serialization
Definition: serialization.h:97
tesseract_common::JointState::access
friend class boost::serialization::access
Definition: joint_state.h:78
tesseract_common::JointTrajectory::JointTrajectory
JointTrajectory(std::string description="")
Definition: joint_state.cpp:73
tesseract_common::JointTrajectory::erase
iterator erase(const_iterator p)
erases element
Definition: joint_state.cpp:153
tesseract_common::JointTrajectory::begin
iterator begin()
returns an iterator to the beginning
Definition: joint_state.cpp:96
tesseract_common::JointTrajectory::end
iterator end()
returns an iterator to the end
Definition: joint_state.cpp:98
tesseract_common::JointTrajectory::const_pointer
typename std::vector< value_type >::const_pointer const_pointer
Definition: joint_state.h:108
tesseract_common::JointTrajectory::pop_back
void pop_back()
removes the last element
Definition: joint_state.cpp:174
tesseract_common::JointState
Definition: joint_state.h:49
tesseract_common::JointTrajectory::operator[]
reference operator[](size_type pos)
access specified element
Definition: joint_state.cpp:130
tesseract_common::JointState::operator==
bool operator==(const JointState &other) const
Definition: joint_state.cpp:48
tesseract_common::JointState::joint_names
std::vector< std::string > joint_names
The joint corresponding to the position vector.
Definition: joint_state.h:56
tesseract_common::JointTrajectory::emplace
iterator emplace(const_iterator pos, Args &&... args)
constructs element in-place
Definition: joint_state.cpp:148
tesseract_common::JointTrajectory::cbegin
const_iterator cbegin() const
returns an iterator to the beginning
Definition: joint_state.cpp:104
tesseract_common::JointTrajectory::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: joint_state.cpp:180
tesseract_common::JointState::acceleration
Eigen::VectorXd acceleration
The Acceleration at the waypoint (optional)
Definition: joint_state.h:65
tesseract_common::JointTrajectory
Represents a joint trajectory.
Definition: joint_state.h:85
tesseract_common::JointTrajectory::value_type
JointState value_type
Definition: joint_state.h:104
tesseract_common::JointTrajectory::crbegin
const_reverse_iterator crbegin() const
returns a reverse iterator to the beginning
Definition: joint_state.cpp:106
tesseract_common::JointState::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: joint_state.cpp:63
boost::serialization
Definition: allowed_collision_matrix.h:14
tesseract_common::JointTrajectory::JointTrajectory
JointTrajectory(InputIt first, InputIt last)
Definition: joint_state.h:127
tesseract_common::JointTrajectory::emplace_back
void emplace_back(Args &&... args)
constructs an element in-place at the end
Definition: joint_state.cpp:168
tesseract_common::JointTrajectory::operator!=
bool operator!=(const JointTrajectory &rhs) const
Definition: joint_state.cpp:89
tesseract_common::JointTrajectory::insert
void insert(const_iterator pos, InputIt first, InputIt last)
Definition: joint_state.h:209
tesseract_common::JointState::time
double time
The Time from start at the waypoint (optional)
Definition: joint_state.h:71
tesseract_common::JointTrajectory::reserve
void reserve(size_type n)
reserve number of elements
Definition: joint_state.cpp:115
tesseract_common::JointTrajectory::crend
const_reverse_iterator crend() const
returns a reverse iterator to the end
Definition: joint_state.cpp:107
tesseract_common::JointTrajectory::access
friend class boost::serialization::access
Definition: joint_state.h:239
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: macros.h:72
tesseract_common::JointTrajectory::shrink_to_fit
void shrink_to_fit()
reduces memory usage by freeing unused memory
Definition: joint_state.cpp:117
tesseract_common::JointTrajectory::size
size_type size() const
returns the number of elements
Definition: joint_state.cpp:113
tesseract_common::JointTrajectory::data
pointer data()
direct access to the underlying array
Definition: joint_state.cpp:128
tesseract_common::JointTrajectory::uuid
boost::uuids::uuid uuid
Definition: joint_state.h:91
tesseract_common::JointTrajectory::reverse_iterator
typename std::vector< value_type >::reverse_iterator reverse_iterator
Definition: joint_state.h:122
tesseract_common::JointState::position
Eigen::VectorXd position
The joint position at the waypoint.
Definition: joint_state.h:59
tesseract_common::JointTrajectory::states
std::vector< JointState > states
Definition: joint_state.h:92
tesseract_common::JointTrajectory::difference_type
typename std::vector< value_type >::difference_type difference_type
Definition: joint_state.h:116
tesseract_common::JointTrajectory::const_reference
typename std::vector< value_type >::const_reference const_reference
Definition: joint_state.h:112
tesseract_common::JointState::operator!=
bool operator!=(const JointState &rhs) const
Definition: joint_state.cpp:60
tesseract_common::JointTrajectory::size_type
typename std::vector< value_type >::size_type size_type
Definition: joint_state.h:114
tesseract_common::JointTrajectory::push_back
void push_back(const value_type &x)
adds an element to the end
Definition: joint_state.cpp:158
tesseract_common::JointTrajectory::const_iterator
typename std::vector< value_type >::const_iterator const_iterator
Definition: joint_state.h:120
tesseract_common::JointTrajectory::capacity
size_type capacity() const
returns the number of elements that can be held in currently allocated storage
Definition: joint_state.cpp:116
tesseract_common::JointTrajectory::const_reverse_iterator
typename std::vector< value_type >::const_reverse_iterator const_reverse_iterator
Definition: joint_state.h:124
tesseract_common::JointTrajectory::swap
void swap(std::vector< value_type > &other) noexcept
swaps the contents
Definition: joint_state.cpp:175


tesseract_common
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:40