Gazebo Rendering

API Reference

8.2.1
Node.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 GZ_RENDERING_NODE_HH_
18 #define GZ_RENDERING_NODE_HH_
19 
20 #include <map>
21 #include <string>
22 #include <variant>
23 
24 #include <gz/math/Pose3.hh>
25 #include <gz/math/Quaternion.hh>
26 
27 #include "gz/rendering/config.hh"
29 #include "gz/rendering/Object.hh"
30 #include "gz/rendering/Export.hh"
31 
32 namespace gz
33 {
34  namespace rendering
35  {
36  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
37  //
45  using Variant =
46  std::variant<std::monostate, int, float, double, std::string, bool,
47  unsigned int, int64_t, uint64_t>;
48 
51  class GZ_RENDERING_VISIBLE Node :
52  public virtual Object
53  {
55  public: virtual ~Node();
56 
59  public: virtual bool HasParent() const = 0;
60 
63  public: virtual NodePtr Parent() const = 0;
64 
67  public: virtual void RemoveParent() = 0;
68 
71  public: virtual math::Pose3d LocalPose() const = 0;
72 
75  public: virtual math::Pose3d InitialLocalPose() const = 0;
76 
79  public: virtual void SetLocalPose(const math::Pose3d &_pose) = 0;
80 
83  public: virtual math::Vector3d LocalPosition() const = 0;
84 
89  public: virtual void SetLocalPosition(double _x, double _y,
90  double _z) = 0;
91 
94  public: virtual void SetLocalPosition(
95  const math::Vector3d &_position) = 0;
96 
99  public: virtual math::Quaterniond LocalRotation() const = 0;
100 
105  public: virtual void SetLocalRotation(double _r, double _p,
106  double _y) = 0;
107 
113  public: virtual void SetLocalRotation(double _w, double _x, double _y,
114  double _z) = 0;
115 
118  public: virtual void SetLocalRotation(
119  const math::Quaterniond &_rotation) = 0;
120 
123  public: virtual math::Pose3d WorldPose() const = 0;
124 
127  public: virtual void SetWorldPose(const math::Pose3d &_pose) = 0;
128 
131  public: virtual math::Vector3d WorldPosition() const = 0;
132 
137  public: virtual void SetWorldPosition(double _x, double _y,
138  double _z) = 0;
139 
142  public: virtual void SetWorldPosition(
143  const math::Vector3d &_position) = 0;
144 
147  public: virtual math::Quaterniond WorldRotation() const = 0;
148 
153  public: virtual void SetWorldRotation(double _r, double _p,
154  double _y) = 0;
155 
161  public: virtual void SetWorldRotation(double _w, double _x, double _y,
162  double _z) = 0;
163 
166  public: virtual void SetWorldRotation(
167  const math::Quaterniond &_rotation) = 0;
168 
171  public: virtual math::Pose3d WorldToLocal(
172  const math::Pose3d &_pose) const = 0;
173 
176  public: virtual math::Vector3d Origin() const = 0;
177 
183  public: virtual void SetOrigin(double _x, double _y, double _z) = 0;
184 
188  public: virtual void SetOrigin(const math::Vector3d &_origin) = 0;
189 
192  public: virtual math::Vector3d LocalScale() const = 0;
193 
197  public: virtual void SetLocalScale(double _scale) = 0;
198 
203  public: virtual void SetLocalScale(double _x, double _y, double _z) = 0;
204 
207  public: virtual void SetLocalScale(const math::Vector3d &_scale) = 0;
208 
211  public: virtual math::Vector3d WorldScale() const = 0;
212 
216  public: virtual void SetWorldScale(double _scale) = 0;
217 
222  public: virtual void SetWorldScale(double _x, double _y, double _z) = 0;
223 
226  public: virtual void SetWorldScale(const math::Vector3d &_scale) = 0;
227 
231  public: virtual void Scale(double _scale) = 0;
232 
237  public: virtual void Scale(double _x, double _y, double _z) = 0;
238 
241  public: virtual void Scale(const math::Vector3d &_scale) = 0;
242 
245  public: virtual bool InheritScale() const = 0;
246 
249  public: virtual void SetInheritScale(bool _inherit) = 0;
250 
253  public: virtual unsigned int ChildCount() const = 0;
254 
257  public: virtual bool HasChild(ConstNodePtr _child) const = 0;
258 
262  public: virtual bool HasChildId(unsigned int _id) const = 0;
263 
267  public: virtual bool HasChildName(const std::string &_name) const = 0;
268 
273  public: virtual NodePtr ChildById(unsigned int _id) const = 0;
274 
279  public: virtual NodePtr ChildByName(
280  const std::string &_name) const = 0;
281 
286  public: virtual NodePtr ChildByIndex(unsigned int _index) const = 0;
287 
291  public: virtual void AddChild(NodePtr _child) = 0;
292 
297  public: virtual NodePtr RemoveChild(NodePtr _child) = 0;
298 
304  public: virtual NodePtr RemoveChildById(unsigned int _id) = 0;
305 
311  public: virtual NodePtr RemoveChildByName(const std::string &_name) = 0;
312 
318  public: virtual NodePtr RemoveChildByIndex(unsigned int _index) = 0;
319 
322  public: virtual void RemoveChildren() = 0;
323 
327  public: virtual void SetUserData(
328  const std::string &_key, Variant _value) = 0;
329 
334  public: virtual Variant UserData(const std::string &_key) const = 0;
335 
339  public: virtual bool HasUserData(const std::string &_key) const = 0;
340  };
341  }
342  }
343 }
344 #endif