SkeletonAnimation.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 _GAZEBO_SKELETONANIMATION_HH_
18 #define _GAZEBO_SKELETONANIMATION_HH_
19 
20 #include <map>
21 #include <utility>
22 #include <string>
23 
24 #include <ignition/math/Matrix4.hh>
25 #include <ignition/math/Pose3.hh>
26 
27 #include "gazebo/math/Matrix4.hh"
28 #include "gazebo/math/Pose.hh"
29 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  namespace common
35  {
38 
42  {
45  public: NodeAnimation(const std::string &_name);
46 
48  public: ~NodeAnimation();
49 
52  public: void SetName(const std::string &_name);
53 
56  public: std::string GetName() const;
57 
63  public: void AddKeyFrame(const double _time,
64  const math::Matrix4 &_trans) GAZEBO_DEPRECATED(6.0);
65 
69  public: void AddKeyFrame(const double _time,
70  const ignition::math::Matrix4d &_trans);
71 
77  public: void AddKeyFrame(const double _time,
78  const math::Pose &_pose) GAZEBO_DEPRECATED(6.0);
79 
83  public: void AddKeyFrame(const double _time,
84  const ignition::math::Pose3d &_pose);
85 
88  public: unsigned int GetFrameCount() const;
89 
98  public: void GetKeyFrame(const unsigned int _i, double &_time,
99  math::Matrix4 &_trans) const GAZEBO_DEPRECATED(6.0);
100 
107  public: void GetKeyFrame(const unsigned int _i, double &_time,
108  ignition::math::Matrix4d &_trans) const;
109 
117  public: std::pair<double, math::Matrix4> GetKeyFrame(
118  const unsigned int _i) const GAZEBO_DEPRECATED(6.0);
119 
125  public: std::pair<double, ignition::math::Matrix4d> KeyFrame(
126  const unsigned int _i) const;
127 
130  public: double GetLength() const;
131 
140  public: math::Matrix4 GetFrameAt(double _time, bool _loop = true) const
141  GAZEBO_DEPRECATED(6.0);
142 
149  public: ignition::math::Matrix4d FrameAt(
150  double _time, bool _loop = true) const;
151 
155  public: void Scale(const double _scale);
156 
163  public: double GetTimeAtX(const double _x) const;
164 
166  protected: std::string name;
167 
169  protected: std::map<double, ignition::math::Matrix4d> keyFrames;
170 
172  protected: double length;
173  };
174 
177  {
180  public: SkeletonAnimation(const std::string &_name);
181 
184  public: ~SkeletonAnimation();
185 
188  public: void SetName(const std::string &_name);
189 
192  public: std::string GetName() const;
193 
196  public: unsigned int GetNodeCount() const;
197 
201  public: bool HasNode(const std::string &_node) const;
202 
209  public: void AddKeyFrame(const std::string &_node, const double _time,
210  const math::Matrix4 &_mat) GAZEBO_DEPRECATED(6.0);
211 
216  public: void AddKeyFrame(const std::string &_node, const double _time,
217  const ignition::math::Matrix4d &_mat);
218 
225  public: void AddKeyFrame(const std::string &_node, const double _time,
226  const math::Pose &_pose) GAZEBO_DEPRECATED(6.0);
227 
233  public: void AddKeyFrame(const std::string &_node, const double _time,
234  const ignition::math::Pose3d &_pose);
235 
247  public: math::Matrix4 GetNodePoseAt(const std::string &_node,
248  const double _time, const bool _loop = true)
249  GAZEBO_DEPRECATED(6.0);
250 
260  public: ignition::math::Matrix4d NodePoseAt(const std::string &_node,
261  const double _time, const bool _loop = true);
262 
273  public: std::map<std::string, math::Matrix4> GetPoseAt(
274  const double _time, const bool _loop = true) const
275  GAZEBO_DEPRECATED(6.0);
276 
285  public: std::map<std::string, ignition::math::Matrix4d> PoseAt(
286  const double _time, const bool _loop = true) const;
287 
298  public: std::map<std::string, math::Matrix4> GetPoseAtX(const double _x,
299  const std::string &_node, const bool _loop = true) const
300  GAZEBO_DEPRECATED(6.0);
301 
310  public: std::map<std::string, ignition::math::Matrix4d> PoseAtX(
311  const double _x, const std::string &_node,
312  const bool _loop = true) const;
313 
314 
317  public: void Scale(const double _scale);
318 
321  public: double GetLength() const;
322 
324  protected: std::string name;
325 
327  protected: double length;
328 
330  protected: std::map<std::string, NodeAnimation*> animations;
331  };
333  }
334 }
335 
336 #endif
std::map< double, ignition::math::Matrix4d > keyFrames
the dictionary of key frames, indexed by time
Definition: SkeletonAnimation.hh:169
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
Skeleton animation.
Definition: SkeletonAnimation.hh:176
double length
the duration of the animations (time of last key frame)
Definition: SkeletonAnimation.hh:172
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
A 3x3 matrix class.
Definition: Matrix4.hh:40
std::map< std::string, NodeAnimation * > animations
a dictionary of node animations
Definition: SkeletonAnimation.hh:330
#define GZ_COMMON_VISIBLE
Definition: system.hh:91
std::string name
the name of the animation
Definition: SkeletonAnimation.hh:166
A key frame in an animation.
Definition: KeyFrame.hh:37
std::string name
the node name
Definition: SkeletonAnimation.hh:324
Node animation.
Definition: SkeletonAnimation.hh:41
double length
the duration of the longest animation
Definition: SkeletonAnimation.hh:327