Gazebo Common

API Reference

4.7.0
gz/common/SkeletonNode.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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 IGNITION_COMMON_SKELETON_NODE_HH_
18 #define IGNITION_COMMON_SKELETON_NODE_HH_
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include <ignition/utils/ImplPtr.hh>
25 
26 #include <gz/common/config.hh>
28 #include <gz/common/graphics/Export.hh>
29 
30 namespace ignition
31 {
32  namespace common
33  {
36  class IGNITION_COMMON_GRAPHICS_VISIBLE SkeletonNode
37  {
39  public: enum SkeletonNodeType {NODE, JOINT};
40 
43  public: explicit SkeletonNode(SkeletonNode *_parent);
44 
50  public: SkeletonNode(SkeletonNode *_parent,
51  const std::string &_name,
52  const std::string &_id,
53  const SkeletonNodeType _type = JOINT);
54 
56  public: virtual ~SkeletonNode();
57 
60  public: void Name(const std::string &_name);
61 
64  public: std::string Name() const;
65 
68  public: void Id(const std::string &_id);
69 
72  public: std::string Id() const;
73 
76  public: void SetType(const SkeletonNodeType _type);
77 
80  public: bool IsJoint() const;
81 
86  public: void SetTransform(const math::Matrix4d &_trans,
87  const bool _updateChildren = true);
88 
93  public: void SetModelTransform(const math::Matrix4d &_trans,
94  const bool _updateChildren = true);
95 
97  public: void UpdateChildrenTransforms();
98 
101  public: void SetInitialTransform(const math::Matrix4d &_trans);
102 
106  public: void Reset(const bool _resetChildren);
107 
109  public: math::Matrix4d Transform() const;
110 
113  public: void SetParent(SkeletonNode *_parent);
114 
117  public: SkeletonNode *Parent() const;
118 
121  public: bool IsRootNode() const;
122 
125  public: void AddChild(SkeletonNode *_child);
126 
129  public: unsigned int ChildCount() const;
130 
134  public: SkeletonNode *Child(const unsigned int _index) const;
135 
139  public: SkeletonNode *ChildByName(const std::string &_name) const;
140 
144  public: SkeletonNode *ChildById(const std::string &_id) const;
145 
148  public: void Handle(const unsigned int _h);
149 
152  public: unsigned int Handle() const;
153 
156  public: void SetInverseBindTransform(const math::Matrix4d &_invBM);
157 
160  public: math::Matrix4d InverseBindTransform() const;
161 
166  public: bool HasInvBindTransform() const;
167 
170  public: math::Matrix4d ModelTransform() const;
171 
174  public: std::vector<NodeTransform> RawTransforms() const;
175 
178  public: unsigned int RawTransformCount() const;
179 
183  public: NodeTransform RawTransform(const unsigned int _i) const;
184 
187  public: void AddRawTransform(const NodeTransform &_t);
188 
191  public: std::vector<NodeTransform> Transforms() const;
192 
194  IGN_UTILS_IMPL_PTR(dataPtr)
195  };
196 
198  }
199 }
200 #endif
Forward declarations for the common classes.
SkeletonNodeType
enumeration of node types
Definition: gz/common/SkeletonNode.hh:39
STL class.
STL class.
STL class.
A transformation node.
Definition: gz/common/NodeTransform.hh:37
std::map< unsigned int, SkeletonNode * > SkeletonNodeMap
Definition: gz/common/SkeletonNode.hh:197
A skeleton node.
Definition: gz/common/SkeletonNode.hh:36