Gazebo Rendering

API Reference

6.6.3
gz/rendering/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 ignition
33 {
34  namespace rendering
35  {
36  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
37  //
45  using Variant =
46  std::variant<std::monostate, int, float, double, std::string, bool,
47  unsigned int>;
48 
51  class IGNITION_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
virtual bool HasParent() const =0
Determine if this Node is attached to another Node.
virtual math::Pose3d WorldPose() const =0
Get the world pose.
std::variant< std::monostate, int, float, double, std::string, bool, unsigned int > Variant
Alias for a variant that can hold various types of data. The first type of the variant is std::monost...
Definition: gz/rendering/Node.hh:47
virtual bool HasChildId(unsigned int _id) const =0
Determine if node with given ID is an attached child.
virtual void AddChild(NodePtr _child)=0
Add the given node to this node. If the given node is already a child, no work will be done.
Represents a single posable node in the scene graph.
Definition: gz/rendering/Node.hh:51
virtual math::Pose3d LocalPose() const =0
Get the local pose.
STL class.
virtual void SetLocalPosition(double _x, double _y, double _z)=0
Set the local position.
STL class.
virtual math::Vector3d WorldPosition() const =0
Get the world position.
virtual NodePtr RemoveChildById(unsigned int _id)=0
Remove (detach) the node with the given ID from this node. If the specified node is not a child of th...
virtual NodePtr ChildByIndex(unsigned int _index) const =0
Get node at given index. If no child exists at given index, NULL will be returned.
virtual NodePtr ChildByName(const std::string &_name) const =0
Get node with given name. If no child exists with given name, NULL will be returned.
virtual math::Vector3d LocalPosition() const =0
Get the local position.
virtual Variant UserData(const std::string &_key) const =0
Get custom data stored in this node.
virtual void SetLocalScale(double _scale)=0
Set the local scale. The given scale will be assigned to the x, y, and z coordinates.
virtual void RemoveParent()=0
Detach this Node from its parent. If this Node does not have a parent, no work will be done.
virtual NodePtr RemoveChild(NodePtr _child)=0
Remove (detach) the given node from this node. If the given node is not a child of this node,...
virtual void RemoveChildren()=0
Remove all child nodes from this node This detaches all the child nodes but does not destroy them.
virtual NodePtr ChildById(unsigned int _id) const =0
Get node with given ID. If no child exists with given ID, NULL will be returned.
virtual ~Node()
Deconstructor.
Definition: gz/rendering/Node.hh:55
virtual math::Pose3d InitialLocalPose() const =0
Get the initial local pose.
virtual void SetWorldPose(const math::Pose3d &_pose)=0
Set the world pose.
virtual unsigned int ChildCount() const =0
Get number of child nodes.
virtual math::Vector3d WorldScale() const =0
Get the world scale.
virtual bool InheritScale() const =0
Determine if this visual inherits scale from this parent.
virtual void SetLocalRotation(double _r, double _p, double _y)=0
Set the local rotation.
virtual NodePtr Parent() const =0
Get the parent Node.
virtual void SetLocalPose(const math::Pose3d &_pose)=0
Set the local pose.
virtual void SetWorldRotation(double _r, double _p, double _y)=0
Set the world rotation.
virtual void SetWorldScale(double _scale)=0
Set the world scale. The given scale will be assigned to the x, y, and z coordinates.
virtual math::Vector3d LocalScale() const =0
Get the local scale.
virtual bool HasChild(ConstNodePtr _child) const =0
Determine if given node is an attached child.
virtual bool HasUserData(const std::string &_key) const =0
Check if node has custom data.
virtual math::Pose3d WorldToLocal(const math::Pose3d &_pose) const =0
Convert given world pose to local pose.
virtual void SetWorldPosition(double _x, double _y, double _z)=0
Set the world position.
virtual bool HasChildName(const std::string &_name) const =0
Determine if node with given name is an attached child.
virtual void SetUserData(const std::string &_key, Variant _value)=0
Store any custom data associated with this node.
virtual math::Quaterniond LocalRotation() const =0
Get the local rotation.
virtual math::Quaterniond WorldRotation() const =0
Get the world rotation.
virtual NodePtr RemoveChildByIndex(unsigned int _index)=0
Remove (detach) the node at the given index from this node. If the specified node is not a child of t...
Represents an object present in the scene graph. This includes sub-meshes, materials,...
Definition: gz/rendering/Object.hh:34
virtual void SetOrigin(double _x, double _y, double _z)=0
Set position of origin. The position should be relative to the original origin of the geometry.
virtual NodePtr RemoveChildByName(const std::string &_name)=0
Remove (detach) the node with the given name from this node. If the specified node is not a child of ...
virtual math::Vector3d Origin() const =0
Get position of origin.
virtual void Scale(double _scale)=0
Scale the current scale by the given scalar. The given scalar will be assigned to the x,...
virtual void SetInheritScale(bool _inherit)=0
Specify if this visual inherits scale from its parent.