Gazebo Common

API Reference

3.17.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 GZ_COMMON_SKELETON_HH_
18 #define GZ_COMMON_SKELETON_HH_
19 
20 #include <vector>
21 #include <string>
22 #include <map>
23 #include <utility>
24 
25 #include <gz/math/Matrix4.hh>
27 #include <gz/common/graphics/Export.hh>
28 
29 namespace ignition
30 {
31  namespace common
32  {
34  class SkeletonPrivate;
35  class SkeletonAnimation;
36 
39  class IGNITION_COMMON_GRAPHICS_VISIBLE Skeleton
40  {
42  public: Skeleton();
43 
46  public: explicit Skeleton(SkeletonNode *_root);
47 
49  public: virtual ~Skeleton();
50 
53  public: void RootNode(SkeletonNode *_node);
54 
57  public: SkeletonNode *RootNode() const;
58 
62  public: SkeletonNode *NodeByName(const std::string &_name) const;
63 
67  public: SkeletonNode *NodeById(const std::string &_id) const;
68 
72  public: SkeletonNode *NodeByHandle(const unsigned int _handle) const;
73 
76  public: unsigned int NodeCount() const;
77 
80  public: unsigned int JointCount() const;
81 
84  public: void Scale(const double _scale);
85 
88  public: void SetBindShapeTransform(const math::Matrix4d &_trans);
89 
92  public: math::Matrix4d BindShapeTransform() const;
93 
95  public: void PrintTransforms() const;
96 
99  public: const SkeletonNodeMap &Nodes() const;
100 
103  public: void SetNumVertAttached(const unsigned int _vertices);
104 
109  public: void AddVertNodeWeight(const unsigned int _vertex,
110  const std::string &_node, const double _weight);
111 
115  public: unsigned int VertNodeWeightCount(
116  const unsigned int _vertex) const;
117 
122  public: std::pair<std::string, double> VertNodeWeight(
123  const unsigned int _v, const unsigned int _i) const;
124 
127  public: unsigned int AnimationCount() const;
128 
132  public: SkeletonAnimation *Animation(const unsigned int _i) const;
133 
137  public: void AddAnimation(SkeletonAnimation *_anim);
138 
143  public: bool AddBvhAnimation(const std::string &_bvhFile, double _scale);
144 
150  public: std::string NodeNameAnimToSkin(unsigned int _index,
151  const std::string &_animNodeName);
152 
158  public: math::Matrix4d AlignTranslation(unsigned int _index,
159  const std::string &_animNodeName);
160 
166  public: math::Matrix4d AlignRotation(unsigned int _index,
167  const std::string &_animNodeName);
168 
171  private: void BuildNodeMap();
172 
174  private: SkeletonPrivate *data;
175  };
176  }
177 }
178 #endif
Forward declarations for the common classes.
STL class.
A skeleton, usually used for animation purposes.
Definition: gz/common/Skeleton.hh:39
Manages an animation, which is a collection of keyframes and the ability to interpolate between the k...
Definition: gz/common/Animation.hh:42
STL class.
Skeleton animation.
Definition: gz/common/SkeletonAnimation.hh:40
A skeleton node.
Definition: gz/common/SkeletonNode.hh:36