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);
102 public:
void SetBindShapeTransform(
103 const ignition::math::Matrix4d &_trans);
107 public: ignition::math::Matrix4d BindShapeTransform();
110 public:
void PrintTransforms();
113 public: NodeMap GetNodes();
117 public:
void SetNumVertAttached(
unsigned int _vertices);
123 public:
void AddVertNodeWeight(
unsigned int _vertex, std::string _node,
129 public:
unsigned int GetNumVertNodeWeights(
unsigned int _vertex);
135 public: std::pair<std::string, double> GetVertNodeWeight(
unsigned int _v,
140 public:
unsigned int GetNumAnimations();
154 protected:
void BuildNodeMap();
169 protected: std::vector<SkeletonAnimation*>
anims;
196 public:
void SetName(std::string _name);
200 public: std::string GetName();
204 public:
void SetId(std::string _id);
208 public: std::string GetId();
216 public:
bool IsJoint();
222 public:
void SetTransform(
const ignition::math::Matrix4d &_trans,
223 bool _updateChildren =
true);
229 public:
void SetModelTransform(
const ignition::math::Matrix4d &_trans,
230 bool _updateChildren =
true);
233 public:
void UpdateChildrenTransforms();
237 public:
void SetInitialTransform(
const ignition::math::Matrix4d &_tras);
242 public:
void Reset(
bool _resetChildren);
246 public: ignition::math::Matrix4d Transform();
258 public:
bool IsRootNode();
266 public:
unsigned int GetChildCount();
276 public:
SkeletonNode* GetChildByName(std::string _name);
285 public:
void SetHandle(
unsigned int _h);
289 public:
unsigned int GetHandle();
293 public:
void SetInverseBindTransform(
294 const ignition::math::Matrix4d &_invBM);
298 public: ignition::math::Matrix4d InverseBindTransform();
302 public: ignition::math::Matrix4d ModelTransform()
const;
306 public: std::vector<NodeTransform> GetRawTransforms();
310 public:
unsigned int GetNumRawTrans();
323 public: std::vector<NodeTransform> GetTransforms();
329 protected: std::string
id;
375 const std::string &_sid =
"_default_",
383 public:
void Set(
const ignition::math::Matrix4d &_mat);
391 public:
void SetSID(std::string _sid);
395 public: ignition::math::Matrix4d GetTransform()
const;
403 public: std::string GetSID();
408 public:
void SetComponent(
unsigned int _idx,
double _value);
412 public:
void SetSourceValues(
const ignition::math::Matrix4d &_mat);
416 public:
void SetSourceValues(
const ignition::math::Vector3d &_vec);
421 public:
void SetSourceValues(
const ignition::math::Vector3d &_axis,
422 const double _angle);
425 public:
void RecalculateMatrix();
428 public:
void PrintSource();
432 public: ignition::math::Matrix4d operator()();
437 public: ignition::math::Matrix4d operator*(
NodeTransform _t);
442 public: ignition::math::Matrix4d operator*(
443 const ignition::math::Matrix4d &_m);
446 protected: std::string
sid;
ignition::math::Matrix4d bindShapeTransform
the bind pose skeletal transform
Definition: Skeleton.hh:163
unsigned int handle
handle index number
Definition: Skeleton.hh:353
A skeleton.
Definition: Skeleton.hh:53
Forward declarations for the common classes.
Definition: Animation.hh:33
SkeletonNodeType type
the type fo node
Definition: Skeleton.hh:332
SkeletonNodeType
enumeration of node types
Definition: Skeleton.hh:177
SkeletonNode * root
the root node
Definition: Skeleton.hh:157
Skeleton animation.
Definition: SkeletonAnimation.hh:128
std::vector< NodeTransform > rawTransforms
the raw transformation
Definition: Skeleton.hh:356
std::string name
the name of the skeletal node
Definition: Skeleton.hh:326
NodeMap nodes
The dictionary of nodes, indexed by name.
Definition: Skeleton.hh:160
std::map< double, std::vector< NodeTransform > > RawNodeAnim
Definition: Skeleton.hh:42
std::map< unsigned int, SkeletonNode * > NodeMap
Definition: Skeleton.hh:37
ignition::math::Matrix4d modelTransform
the model transformation
Definition: Skeleton.hh:341
std::vector< SkeletonAnimation * > anims
the array of animations
Definition: Skeleton.hh:169
ignition::math::Matrix4d initialTransform
the initial transformation
Definition: Skeleton.hh:338
A skeleton node.
Definition: Skeleton.hh:174
ignition::math::Matrix4d transform
the transform
Definition: Skeleton.hh:335
std::map< unsigned int, SkeletonNode * >::iterator NodeMapIter
Definition: Skeleton.hh:40
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:344
SkeletonNode * parent
the parent node
Definition: Skeleton.hh:347
RawNodeWeights rawNW
the node weight table
Definition: Skeleton.hh:166
std::vector< SkeletonNode * > children
the children nodes
Definition: Skeleton.hh:350
std::vector< std::vector< std::pair< std::string, double > > > RawNodeWeights
Definition: Skeleton.hh:46
std::map< std::string, RawNodeAnim > RawSkeletonAnim
Definition: Skeleton.hh:43
std::string id
a string identifier
Definition: Skeleton.hh:329