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> > >
89 public:
SkeletonNode* GetNodeByHandle(
unsigned int _handle);
93 public:
unsigned int GetNumNodes();
97 public:
unsigned int GetNumJoints();
101 public:
void Scale(
double _scale);
105 public:
void SetBindShapeTransform(
106 const ignition::math::Matrix4d &_trans);
110 public: ignition::math::Matrix4d BindShapeTransform();
113 public:
void PrintTransforms();
116 public: NodeMap GetNodes();
121 public:
void SetNumVertAttached(
unsigned int _vertices);
127 public:
void AddVertNodeWeight(
unsigned int _vertex, std::string _node,
133 public:
unsigned int GetNumVertNodeWeights(
unsigned int _vertex);
139 public: std::pair<std::string, double> GetVertNodeWeight(
unsigned int _v,
144 public:
unsigned int GetNumAnimations();
158 protected:
void BuildNodeMap();
167 protected: ignition::math::Matrix4d bindShapeTransform =
168 ignition::math::Matrix4d::Identity;
174 protected: std::vector<SkeletonAnimation*>
anims;
201 public:
void SetName(std::string _name);
207 public: std::string GetName();
214 public: std::string Name()
const;
218 public:
void SetId(std::string _id);
222 public: std::string GetId();
230 public:
bool IsJoint();
236 public:
void SetTransform(
const ignition::math::Matrix4d &_trans,
237 bool _updateChildren =
true);
243 public:
void SetModelTransform(
const ignition::math::Matrix4d &_trans,
244 bool _updateChildren =
true);
247 public:
void UpdateChildrenTransforms();
251 public:
void SetInitialTransform(
const ignition::math::Matrix4d &_tras);
256 public:
void Reset(
bool _resetChildren);
260 public: ignition::math::Matrix4d Transform();
272 public:
bool IsRootNode();
280 public:
unsigned int GetChildCount();
290 public:
SkeletonNode* GetChildByName(std::string _name);
299 public:
void SetHandle(
unsigned int _h);
303 public:
unsigned int GetHandle();
307 public:
void SetInverseBindTransform(
308 const ignition::math::Matrix4d &_invBM);
312 public: ignition::math::Matrix4d InverseBindTransform();
318 public:
bool HasInvBindTransform();
322 public: ignition::math::Matrix4d ModelTransform()
const;
326 public: std::vector<NodeTransform> GetRawTransforms();
330 public:
unsigned int GetNumRawTrans();
343 public: std::vector<NodeTransform> GetTransforms();
349 protected: std::string
id;
395 const std::string &_sid =
"_default_",
403 public:
void Set(
const ignition::math::Matrix4d &_mat);
411 public:
void SetSID(std::string _sid);
415 public: ignition::math::Matrix4d GetTransform()
const;
423 public: std::string GetSID();
428 public:
void SetComponent(
unsigned int _idx,
double _value);
432 public:
void SetSourceValues(
const ignition::math::Matrix4d &_mat);
436 public:
void SetSourceValues(
const ignition::math::Vector3d &_vec);
441 public:
void SetSourceValues(
const ignition::math::Vector3d &_axis,
442 const double _angle);
445 public:
void RecalculateMatrix();
448 public:
void PrintSource();
452 public: ignition::math::Matrix4d operator()();
457 public: ignition::math::Matrix4d operator*(
NodeTransform _t);
462 public: ignition::math::Matrix4d operator*(
463 const ignition::math::Matrix4d &_m);
466 protected: std::string
sid;
unsigned int handle
handle index number
Definition: Skeleton.hh:373
A skeleton.
Definition: Skeleton.hh:52
Forward declarations for the common classes.
Definition: Animation.hh:26
SkeletonNodeType type
the type fo node
Definition: Skeleton.hh:352
SkeletonNodeType
enumeration of node types
Definition: Skeleton.hh:182
SkeletonNode * root
the root node
Definition: Skeleton.hh:161
Skeleton animation.
Definition: SkeletonAnimation.hh:126
std::vector< NodeTransform > rawTransforms
the raw transformation
Definition: Skeleton.hh:376
std::string name
the name of the skeletal node
Definition: Skeleton.hh:346
NodeMap nodes
The dictionary of nodes, indexed by name.
Definition: Skeleton.hh:164
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:361
std::vector< SkeletonAnimation * > anims
the array of animations
Definition: Skeleton.hh:174
ignition::math::Matrix4d initialTransform
the initial transformation
Definition: Skeleton.hh:358
A skeleton node.
Definition: Skeleton.hh:179
ignition::math::Matrix4d transform
the transform
Definition: Skeleton.hh:355
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:364
SkeletonNode * parent
the parent node
Definition: Skeleton.hh:367
RawNodeWeights rawNW
the node weight table
Definition: Skeleton.hh:171
std::vector< SkeletonNode * > children
the children nodes
Definition: Skeleton.hh:370
common
Definition: FuelModelDatabase.hh:37
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:349