17 #ifndef _GAZEBO_SKELETON_HH_
18 #define _GAZEBO_SKELETON_HH_
25 #include <ignition/math/Matrix4.hh>
39 typedef std::map<unsigned int, SkeletonNode*>
NodeMap;
40 typedef std::map<unsigned int, SkeletonNode*>::iterator
NodeMapIter;
42 typedef std::map<double, std::vector<NodeTransform> >
RawNodeAnim;
45 typedef std::vector<std::vector<std::pair<std::string, double> > >
86 public:
SkeletonNode* GetNodeByHandle(
unsigned int _handle);
90 public:
unsigned int GetNumNodes();
94 public:
unsigned int GetNumJoints();
98 public:
void Scale(
double _scale);
109 public:
void SetBindShapeTransform(
110 const ignition::math::Matrix4d &_trans);
120 public: ignition::math::Matrix4d BindShapeTransform();
123 public:
void PrintTransforms();
130 public:
void SetNumVertAttached(
unsigned int _vertices);
136 public:
void AddVertNodeWeight(
unsigned int _vertex, std::string _node,
142 public:
unsigned int GetNumVertNodeWeights(
unsigned int _vertex);
148 public: std::pair<std::string, double> GetVertNodeWeight(
unsigned int _v,
153 public:
unsigned int GetNumAnimations();
167 protected:
void BuildNodeMap();
182 protected: std::vector<SkeletonAnimation*>
anims;
202 std::string _id, SkeletonNodeType _type = JOINT);
209 public:
void SetName(std::string _name);
213 public: std::string GetName();
217 public:
void SetId(std::string _id);
221 public: std::string GetId();
225 public:
void SetType(SkeletonNodeType _type);
229 public:
bool IsJoint();
244 public:
void SetTransform(const ignition::math::Matrix4d &_trans,
245 bool _updateChildren = true);
253 public:
void SetModelTransform(math::Matrix4 _trans,
260 public:
void SetModelTransform(const ignition::math::Matrix4d &_trans,
261 bool _updateChildren = true);
264 public:
void UpdateChildrenTransforms();
270 public:
void SetInitialTransform(math::Matrix4 _tras)
271 GAZEBO_DEPRECATED(6.0);
275 public:
void SetInitialTransform(const ignition::math::Matrix4d &_tras);
280 public:
void Reset(
bool _resetChildren);
286 public: math::Matrix4 GetTransform() GAZEBO_DEPRECATED(6.0);
290 public: ignition::math::Matrix4d Transform();
302 public:
bool IsRootNode();
310 public:
unsigned int GetChildCount();
320 public:
SkeletonNode* GetChildByName(std::
string _name);
329 public:
void SetHandle(
unsigned int _h);
333 public:
unsigned int GetHandle();
339 public:
void SetInverseBindTransform(math::Matrix4 _invBM)
340 GAZEBO_DEPRECATED(6.0);
344 public:
void SetInverseBindTransform(
345 const ignition::math::Matrix4d &_invBM);
351 public: math::Matrix4 GetInverseBindTransform() GAZEBO_DEPRECATED(6.0);
355 public: ignition::math::Matrix4d InverseBindTransform();
361 public: math::Matrix4 GetModelTransform() GAZEBO_DEPRECATED(6.0);
365 public: ignition::math::Matrix4d ModelTransform() const;
373 public:
unsigned int GetNumRawTrans();
389 protected: std::
string name;
392 protected: std::
string id;
398 protected: ignition::math::Matrix4d transform;
401 protected: ignition::math::Matrix4d initialTransform;
404 protected: ignition::math::Matrix4d modelTransform;
407 protected: ignition::math::Matrix4d invBindTransform;
416 protected:
unsigned int handle;
431 public: NodeTransform(TransformType _type = MATRIX);
439 public: NodeTransform(
math::Matrix4 _mat, std::string _sid =
"_default_",
440 TransformType _type = MATRIX) GAZEBO_DEPRECATED(6.0);
446 public: NodeTransform(const ignition::math::Matrix4d &_mat,
447 const std::
string &_sid = "_default_",
448 TransformType _type = MATRIX);
451 public: ~NodeTransform();
457 public:
void Set(math::Matrix4 _mat) GAZEBO_DEPRECATED(6.0);
461 public:
void Set(const ignition::math::Matrix4d &_mat);
465 public:
void SetType(TransformType _type);
469 public:
void SetSID(std::
string _sid);
475 public: math::Matrix4 Get() GAZEBO_DEPRECATED(6.0);
479 public: ignition::math::Matrix4d GetTransform() const;
483 public: TransformType GetType();
487 public: std::
string GetSID();
492 public:
void SetComponent(
unsigned int _idx,
double _value);
498 public:
void SetSourceValues(math::Matrix4 _mat) GAZEBO_DEPRECATED(6.0);
502 public:
void SetSourceValues(const ignition::math::Matrix4d &_mat);
508 public:
void SetSourceValues(math::Vector3 _vec) GAZEBO_DEPRECATED(6.0);
512 public:
void SetSourceValues(const ignition::math::Vector3d &_vec);
519 public:
void SetSourceValues(math::Vector3 _axis,
double _angle)
520 GAZEBO_DEPRECATED(6.0);
525 public:
void SetSourceValues(const ignition::math::Vector3d &_axis,
526 const
double _angle);
529 public:
void RecalculateMatrix();
532 public:
void PrintSource();
536 public: ignition::math::Matrix4d operator()();
541 public: ignition::math::Matrix4d operator*(NodeTransform _t);
547 public: math::Matrix4 operator* (math::Matrix4 _m) GAZEBO_DEPRECATED(6.0);
552 public: ignition::math::Matrix4d operator*(
553 const ignition::math::Matrix4d &_m);
556 protected: std::
string sid;
562 protected: ignition::math::Matrix4d transform;
565 protected: std::vector<
double> source;
std::map< unsigned int, SkeletonNode * > NodeMap
Definition: Skeleton.hh:37
A skeleton.
Definition: Skeleton.hh:53
Skeleton animation.
Definition: SkeletonAnimation.hh:176
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
A 3x3 matrix class.
Definition: Matrix4.hh:40
std::vector< SkeletonAnimation * > anims
the array of animations
Definition: Skeleton.hh:182
std::map< unsigned int, SkeletonNode * >::iterator NodeMapIter
Definition: Skeleton.hh:40
SkeletonNodeType
enumeration of node types
Definition: Skeleton.hh:190
ignition::math::Matrix4d bindShapeTransform
the bind pose skeletal transform
Definition: Skeleton.hh:176
NodeMap nodes
The dictionary of nodes, indexed by name.
Definition: Skeleton.hh:173
#define SCALE
Definition: SpaceNavPrivate.hh:20
#define GZ_COMMON_VISIBLE
Definition: system.hh:91
RawNodeWeights rawNW
the node weight table
Definition: Skeleton.hh:179
std::map< double, std::vector< NodeTransform > > RawNodeAnim
Definition: Skeleton.hh:42
A skeleton node.
Definition: Skeleton.hh:187
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
std::vector< std::vector< std::pair< std::string, double > > > RawNodeWeights
Definition: Skeleton.hh:46
SkeletonNode * root
the root node
Definition: Skeleton.hh:170
std::map< std::string, RawNodeAnim > RawSkeletonAnim
Definition: Skeleton.hh:43