Gazebo Common

API Reference

4.7.0
gz/common/Skeleton.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_HH_
18 #define IGNITION_COMMON_SKELETON_HH_
19 
20 #include <vector>
21 #include <string>
22 #include <map>
23 #include <utility>
24 
25 #include <gz/math/Matrix4.hh>
26 
27 #include <ignition/utils/ImplPtr.hh>
28 
29 #include <gz/common/config.hh>
31 #include <gz/common/graphics/Export.hh>
32 
33 namespace ignition
34 {
35  namespace common
36  {
37  class SkeletonAnimation;
38 
41  class IGNITION_COMMON_GRAPHICS_VISIBLE Skeleton
42  {
44  public: Skeleton();
45 
48  public: explicit Skeleton(SkeletonNode *_root);
49 
51  public: virtual ~Skeleton();
52 
55  public: void RootNode(SkeletonNode *_node);
56 
59  public: SkeletonNode *RootNode() const;
60 
64  public: SkeletonNode *NodeByName(const std::string &_name) const;
65 
69  public: SkeletonNode *NodeById(const std::string &_id) const;
70 
74  public: SkeletonNode *NodeByHandle(const unsigned int _handle) const;
75 
78  public: unsigned int NodeCount() const;
79 
82  public: unsigned int JointCount() const;
83 
86  public: void Scale(const double _scale);
87 
90  public: void SetBindShapeTransform(const math::Matrix4d &_trans);
91 
94  public: math::Matrix4d BindShapeTransform() const;
95 
97  public: void PrintTransforms() const;
98 
101  public: const SkeletonNodeMap &Nodes() const;
102 
105  public: void SetNumVertAttached(const unsigned int _vertices);
106 
111  public: void AddVertNodeWeight(const unsigned int _vertex,
112  const std::string &_node, const double _weight);
113 
117  public: unsigned int VertNodeWeightCount(
118  const unsigned int _vertex) const;
119 
124  public: std::pair<std::string, double> VertNodeWeight(
125  const unsigned int _v, const unsigned int _i) const;
126 
129  public: unsigned int AnimationCount() const;
130 
134  public: SkeletonAnimation *Animation(const unsigned int _i) const;
135 
139  public: void AddAnimation(SkeletonAnimation *_anim);
140 
145  public: bool AddBvhAnimation(const std::string &_bvhFile, double _scale);
146 
152  public: std::string NodeNameAnimToSkin(unsigned int _index,
153  const std::string &_animNodeName);
154 
160  public: math::Matrix4d AlignTranslation(unsigned int _index,
161  const std::string &_animNodeName);
162 
168  public: math::Matrix4d AlignRotation(unsigned int _index,
169  const std::string &_animNodeName);
170 
173  private: void BuildNodeMap();
174 
176  IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
177  };
178  }
179 }
180 #endif
Forward declarations for the common classes.
STL class.
A skeleton, usually used for animation purposes.
Definition: gz/common/Skeleton.hh:41
Manages an animation, which is a collection of keyframes and the ability to interpolate between the k...
Definition: gz/common/Animation.hh:44
STL class.
Skeleton animation.
Definition: gz/common/SkeletonAnimation.hh:40
A skeleton node.
Definition: gz/common/SkeletonNode.hh:36