marker.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef TESSERACT_VISUALIZATION_MARKERS_MARKER_H
18 #define TESSERACT_VISUALIZATION_MARKERS_MARKER_H
19 
22 #include <chrono>
23 #include <memory>
24 #include <Eigen/Geometry>
26 
28 {
29 enum class MarkerType : int
30 {
32  NONE = 0,
33 
35  GEOMETRY = 1,
36 
38  AXIS = 2,
39 
41  ARROW = 3,
42 
44  LINE_STRIP = 4,
45 
47  LINE_LIST = 5,
48 
50  POINTS = 6,
51 
53  TEXT = 7,
54 
56  TRIANGLE_FAN = 8,
57 
59  TRIANGLE_LIST = 9,
60 
62  TRIANGLE_STRIP = 10,
63 
65  TOOLPATH = 11,
66 
68  CONTACT_RESULTS = 12,
69 
70  // User defined types must be larger than this
71  USER_DEFINED = 1000
72 };
73 
74 class Marker
75 {
76 public:
77  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
78 
79  using Ptr = std::shared_ptr<Marker>;
80  using ConstPtr = std::shared_ptr<const Marker>;
81 
82  Marker() = default;
83  virtual ~Marker() = default;
84  Marker(const Marker&) = default;
85  Marker& operator=(const Marker&) = default;
86  Marker(Marker&&) = default;
87  Marker& operator=(Marker&&) = default;
88 
93  virtual int getType() const = 0;
94 
99  virtual void setParentLink(std::string parent_link);
100 
105  virtual const std::string& getParentLink() const;
106 
111  virtual void setLifetime(const std::chrono::steady_clock::duration& lifetime);
112 
117  virtual std::chrono::steady_clock::duration getLifetime() const;
118 
123  virtual void setLayer(int layer);
124 
129  virtual int getLayer() const;
130 
135  virtual void setScale(const Eigen::Vector3d& scale);
136 
141  virtual const Eigen::Vector3d& getScale() const;
142 
143 protected:
145  std::chrono::steady_clock::duration lifetime_{ 0 };
146 
148  std::string parent_link_;
149 
151  int layer_{ 0 };
152 
154  Eigen::Vector3d scale_{ Eigen::Vector3d(1, 1, 1) };
155 };
156 
157 } // namespace tesseract_visualization
158 #endif // TESSERACT_VISUALIZATION_MARKERS_MARKER_H
tesseract_visualization::Marker::parent_link_
std::string parent_link_
The parent link the marker is attched to. If empty relative to world.
Definition: marker.h:148
tesseract_visualization::MarkerType::TRIANGLE_FAN
@ TRIANGLE_FAN
Triangle fan primitive.
tesseract_visualization::Marker::Marker
Marker()=default
tesseract_visualization::MarkerType::ARROW
@ ARROW
Arrow primitive.
tesseract_visualization::MarkerType::CONTACT_RESULTS
@ CONTACT_RESULTS
Contact results marker.
tesseract_visualization::MarkerType::LINE_STRIP
@ LINE_STRIP
Line strip primitive.
tesseract_visualization::MarkerType::TRIANGLE_STRIP
@ TRIANGLE_STRIP
Triangle strip primitive.
tesseract_visualization::Marker::lifetime_
std::chrono::steady_clock::duration lifetime_
The lifetime of this Marker.
Definition: marker.h:145
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_visualization::Marker::setParentLink
virtual void setParentLink(std::string parent_link)
The parent link name the marker should be attached to.
Definition: marker.cpp:6
tesseract_visualization::Marker::getParentLink
virtual const std::string & getParentLink() const
Get the parent link name that marker should be attached to.
Definition: marker.cpp:8
tesseract_visualization::MarkerType::TEXT
@ TEXT
Text geometry.
tesseract_visualization::Marker::getLifetime
virtual std::chrono::steady_clock::duration getLifetime() const
Get the lifetime of this Marker.
Definition: marker.cpp:12
tesseract_visualization::MarkerType::TRIANGLE_LIST
@ TRIANGLE_LIST
Triangle list primitive.
tesseract_visualization::MarkerType::LINE_LIST
@ LINE_LIST
Line list primitive.
tesseract_visualization::MarkerType::AXIS
@ AXIS
Axis primitive.
tesseract_visualization::Marker::~Marker
virtual ~Marker()=default
tesseract_visualization::MarkerType::TOOLPATH
@ TOOLPATH
Toolpath marker.
TESSERACT_COMMON_IGNORE_WARNINGS_POP
tesseract_visualization::Marker::layer_
int layer_
The layer of the marker.
Definition: marker.h:151
tesseract_visualization::Marker::setLifetime
virtual void setLifetime(const std::chrono::steady_clock::duration &lifetime)
Set the lifetime of the this marker.
Definition: marker.cpp:10
tesseract_visualization::Marker::setLayer
virtual void setLayer(int layer)
Set the layer of this Marker.
Definition: marker.cpp:14
tesseract_visualization::Marker
Definition: marker.h:74
tesseract_visualization::Marker::getLayer
virtual int getLayer() const
Get the layer of this Marker.
Definition: marker.cpp:16
tesseract_visualization::Marker::getType
virtual int getType() const =0
Get the marker type.
tesseract_visualization::MarkerType
MarkerType
Definition: marker.h:29
tesseract_visualization::Marker::operator=
Marker & operator=(const Marker &)=default
tesseract_visualization::MarkerType::NONE
@ NONE
No type.
tesseract_visualization::MarkerType::GEOMETRY
@ GEOMETRY
Tesseract geometry.
tesseract_visualization::Marker::scale_
Eigen::Vector3d scale_
The marker scale.
Definition: marker.h:154
tesseract_visualization::Marker::ConstPtr
std::shared_ptr< const Marker > ConstPtr
Definition: marker.h:80
tesseract_visualization::Marker::getScale
virtual const Eigen::Vector3d & getScale() const
Get the marker scale.
Definition: marker.cpp:20
tesseract_visualization::MarkerType::USER_DEFINED
@ USER_DEFINED
macros.h
tesseract_visualization::Marker::Ptr
std::shared_ptr< Marker > Ptr
Definition: marker.h:79
tesseract_visualization::MarkerType::POINTS
@ POINTS
Points primitive.
tesseract_visualization::Marker::setScale
virtual void setScale(const Eigen::Vector3d &scale)
Set the marker scale.
Definition: marker.cpp:18
tesseract_visualization
Definition: fwd.h:4


tesseract_visualization
Author(s): Levi Armstrong
autogenerated on Wed Apr 9 2025 03:03:25