17 #ifndef GAZEBO_COMMON_SKELETON_HH_
18 #define GAZEBO_COMMON_SKELETON_HH_
25 #include <ignition/math/Matrix4.hh>
38 typedef std::map<unsigned int, SkeletonNode*>
NodeMap;
39 typedef std::map<unsigned int, SkeletonNode*>::iterator
NodeMapIter;
41 typedef std::map<double, std::vector<NodeTransform> >
RawNodeAnim;
44 typedef std::vector<std::vector<std::pair<std::string, double> > >
85 public:
SkeletonNode* GetNodeByHandle(
unsigned int _handle);
89 public:
unsigned int GetNumNodes();
93 public:
unsigned int GetNumJoints();
97 public:
void Scale(
double _scale);
101 public:
void SetBindShapeTransform(
102 const ignition::math::Matrix4d &_trans);
106 public: ignition::math::Matrix4d BindShapeTransform();
109 public:
void PrintTransforms();
116 public:
void SetNumVertAttached(
unsigned int _vertices);
122 public:
void AddVertNodeWeight(
unsigned int _vertex, std::string _node,
128 public:
unsigned int GetNumVertNodeWeights(
unsigned int _vertex);
134 public: std::pair<std::string, double> GetVertNodeWeight(
unsigned int _v,
139 public:
unsigned int GetNumAnimations();
153 protected:
void BuildNodeMap();
168 protected: std::vector<SkeletonAnimation*>
anims;
188 std::string _id, SkeletonNodeType _type = JOINT);
195 public:
void SetName(std::string _name);
199 public: std::string GetName();
203 public:
void SetId(std::string _id);
207 public: std::string GetId();
211 public:
void SetType(SkeletonNodeType _type);
215 public:
bool IsJoint();
221 public:
void SetTransform(
const ignition::math::Matrix4d &_trans,
222 bool _updateChildren =
true);
228 public:
void SetModelTransform(
const ignition::math::Matrix4d &_trans,
229 bool _updateChildren =
true);
232 public:
void UpdateChildrenTransforms();
236 public:
void SetInitialTransform(
const ignition::math::Matrix4d &_tras);
241 public:
void Reset(
bool _resetChildren);
245 public: ignition::math::Matrix4d Transform();
257 public:
bool IsRootNode();
265 public:
unsigned int GetChildCount();
275 public:
SkeletonNode* GetChildByName(std::string _name);
284 public:
void SetHandle(
unsigned int _h);
288 public:
unsigned int GetHandle();
292 public:
void SetInverseBindTransform(
293 const ignition::math::Matrix4d &_invBM);
297 public: ignition::math::Matrix4d InverseBindTransform();
301 public: ignition::math::Matrix4d ModelTransform()
const;
305 public: std::vector<NodeTransform> GetRawTransforms();
309 public:
unsigned int GetNumRawTrans();
322 public: std::vector<NodeTransform> GetTransforms();
328 protected: std::string
id;
374 const std::string &_sid =
"_default_",
375 TransformType _type = MATRIX);
382 public:
void Set(
const ignition::math::Matrix4d &_mat);
386 public:
void SetType(TransformType _type);
390 public:
void SetSID(std::string _sid);
394 public: ignition::math::Matrix4d GetTransform()
const;
398 public: TransformType GetType();
402 public: std::string GetSID();
407 public:
void SetComponent(
unsigned int _idx,
double _value);
411 public:
void SetSourceValues(
const ignition::math::Matrix4d &_mat);
415 public:
void SetSourceValues(
const ignition::math::Vector3d &_vec);
420 public:
void SetSourceValues(
const ignition::math::Vector3d &_axis,
421 const double _angle);
424 public:
void RecalculateMatrix();
427 public:
void PrintSource();
431 public: ignition::math::Matrix4d operator()();
436 public: ignition::math::Matrix4d operator*(
NodeTransform _t);
441 public: ignition::math::Matrix4d operator*(
442 const ignition::math::Matrix4d &_m);
445 protected: std::string
sid;
ignition::math::Matrix4d bindShapeTransform
the bind pose skeletal transform
Definition: Skeleton.hh:162
unsigned int handle
handle index number
Definition: Skeleton.hh:352
A skeleton.
Definition: Skeleton.hh:52
SkeletonNodeType type
the type fo node
Definition: Skeleton.hh:331
SkeletonNodeType
enumeration of node types
Definition: Skeleton.hh:176
SkeletonNode * root
the root node
Definition: Skeleton.hh:156
Skeleton animation.
Definition: SkeletonAnimation.hh:126
std::vector< NodeTransform > rawTransforms
the raw transformation
Definition: Skeleton.hh:355
std::string name
the name of the skeletal node
Definition: Skeleton.hh:325
NodeMap nodes
The dictionary of nodes, indexed by name.
Definition: Skeleton.hh:159
std::map< double, std::vector< NodeTransform > > RawNodeAnim
Definition: Skeleton.hh:41
std::map< unsigned int, SkeletonNode * > NodeMap
Definition: Skeleton.hh:36
ignition::math::Matrix4d modelTransform
the model transformation
Definition: Skeleton.hh:340
std::vector< SkeletonAnimation * > anims
the array of animations
Definition: Skeleton.hh:168
ignition::math::Matrix4d initialTransform
the initial transformation
Definition: Skeleton.hh:337
A skeleton node.
Definition: Skeleton.hh:173
ignition::math::Matrix4d transform
the transform
Definition: Skeleton.hh:334
std::map< unsigned int, SkeletonNode * >::iterator NodeMapIter
Definition: Skeleton.hh:39
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
ignition::math::Matrix4d invBindTransform
the inverse of the bind pose skeletal transform
Definition: Skeleton.hh:343
SkeletonNode * parent
the parent node
Definition: Skeleton.hh:346
RawNodeWeights rawNW
the node weight table
Definition: Skeleton.hh:165
std::vector< SkeletonNode * > children
the children nodes
Definition: Skeleton.hh:349
std::vector< std::vector< std::pair< std::string, double > > > RawNodeWeights
Definition: Skeleton.hh:45
std::map< std::string, RawNodeAnim > RawSkeletonAnim
Definition: Skeleton.hh:42
std::string id
a string identifier
Definition: Skeleton.hh:328