Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | Protected Attributes
osgDart::SkeletonNode Class Reference

Class which inherits osg::Group. More...

#include <SkeletonNode.h>

List of all members.

Public Member Functions

 SkeletonNode (const dart::dynamics::Skeleton &skeleton, bool debug=false)
 Constructor for SkeletonNode.
 ~SkeletonNode ()
 Destructor for SkeletonNode.
void update ()
 Update SkeletonNode MatrixTransforms based on the dart::Skeleton BodyNode world transforms. This is done recursively by traversing through the Skeleton bodyNodes and their children.
void setJointAxesVisible (bool makeVisible=false)
 Shows or hides the individual joint axes. This applies to skeletons with more than one link. A single line with an arrow is displayed representing the axis of rotation of the joint. This currently only applies to revolute joints.
void setBodyNodeAxesVisible (bool makeVisible=false)
 Shows or hides the individual link frames, represented by x,y,z axes using the color scheme red, green, blue, respectively. Currently this function doesn't account for different sized objects so axes may not be visible for larger objects.
void setBodyNodeCoMVisible (bool makeVisible=false)
 Shows or hides the individual link center of masses, represented by a sphere. Currently not implemented.
void setSkeletonCoMVisible (bool makeVisible=false)
 Shows or hides the skeleton's center of mass, represented by a sphere.
void setSkeletonCoMProjectedVisible (bool makeVisible=false)
 Shows or hides the skeleton's projected center of mass, represented by a circle on the ground.
void setSkeletonRenderMode (renderMode_t renderMode)
 Set the render mode of the Skeleton.
void setBodyNodeTransparency (const dart::dynamics::BodyNode &node, float transparencyValue)
 Sets the transparency value of the specified BodyNode.
const dart::dynamics::BodyNode & getRootBodyNode ()
 Get root body node.

Protected Member Functions

void _createSkeleton ()
 Create the osg skeleton from the root BodyNode by traversing its children and creating osg::Nodes for each physical BodyNode and putting them inside a osg::MatrixTransform with it transform set to the BodyNode's world transform.
void _addSkeletonVisuals ()
 Add visual elements of skeleton that can be toggled on or off, such as the center of mass.
void _addSkeletonObjectsRecursivley (const dart::dynamics::BodyNode &bodyNode)
 Recursively build osg skeleton starting with a BodyNode and recursively creating its children. An osg::MatrixTransform get created whose transform corresponds to the BodyNode's world transform and then an osg::Group node gets created from the BodyNode's shape information and get put inside the osg::MatrixTransform. Finally the osg::MatrixTransform gets added as a child to the root node of the SkeletonNode and it will recursively add osg::MatrixTransforms and Geode for all the children.
osg::Group * _makeBodyNodeGroup (const dart::dynamics::BodyNode &node)
 Create osg::Group* object from a dart::dynamics::BodyNode passed in by reference. It generates the shape information in an OpenSceneGraph format, looping through the BodyNode's visualization shapes and converting them from aiScene objects to osg::Node objects and adding them as children to the BodyNode osg::Group.
osg::Group * _makeBodyNodeCollisionMeshGroup (const dart::dynamics::BodyNode &node)
 Create osg::Group* object from a dart::dynamics::BodyNode passed in by reference. It generates the shape information in an OpenSceneGraph format, looping through the BodyNode's collision shapes and converting them from aiScene objects to osg::Node objects and adding them as children to the BodyNode osg::Group.
osgDart::BodyNodeVisuals_makeBodyNodeVisuals (const dart::dynamics::BodyNode &node)
 Create an osgDart::BodyNodeVisuals* object from a dart::dynamics::BodyNode passed in by reference. It generates the BodyNode specific visuals such as link frame and joint axis for the passed-in BodyNode.
void _addVisualizationShapesFromBodyNode (const dart::dynamics::BodyNode &node)
 Convert BodyNode visualization shapes to osg shapes.
void _addCollisionShapesFromBodyNode (const dart::dynamics::BodyNode &node)
 Convert BodyNode collision shapes to osg shapes.
void _updateRecursively (const dart::dynamics::BodyNode &bodyNode)
 Update SkeletonNode recursively based on Skeleton transforms. This traverses through each BodyNode and its child BodyNodes and updates corresponding osg::MatrixTransform based on their current world transform.
void _updateSkeletonVisuals ()
 Updates the skeleton visuals.

Protected Attributes

const dart::dynamics::BodyNode & _rootBodyNode
 Root BodyNode.
std::vector< osg::ref_ptr
< osg::Group > > 
_bodyNodeGroups
 Array of osg::Group pointers for the dart::dynamics::BodyNode visualization objects.
std::vector< osg::ref_ptr
< osgDart::BodyNodeVisuals > > 
_bodyNodeVisuals
 Array of osgDart::BodyNodeVisuals ref pointers for showing/hiding them.
osg::ref_ptr
< osgDart::SkeletonVisuals
_skeletonVisuals
 osgDart::SkeletonVisuals ref pointer for showing/hiding them
std::vector< osg::ref_ptr
< osg::Group > > 
_bodyNodeCollisionMeshGroups
 Array of osg::Group ref pointers for showing/hiding them.
BodyNodeMatrixMap _bodyNodeMatrixMap
 Map from dart::dynamics::Joint* to osg::MatrixTransform*.
BodyNodeGroupMap _bodyNodeGroupMap
 Map from dart::dynamics::BodyNode* to osg::Group* for the visualization shapes.
BodyNodeGroupMap _bodyNodeCollsionMeshGroupMap
 Map from dart::dynamics::BodyNode* to osg::Group* for the collision shapes.
BodyNodeVisualsMap _bodyNodeVisualsMap
 Map from dart::dynamics::BodyNode* to osgDart::BodyNodeVisuals for BodyNode visual shapes.
const bool _debug
 Debug variable for whether or not to print debug output.

Detailed Description

Class which inherits osg::Group.


Constructor & Destructor Documentation

SkeletonNode::SkeletonNode ( const dart::dynamics::Skeleton &  skeleton,
bool  debug = false 
)

Constructor for SkeletonNode.

Parameters:
skeletonA dart::dynamics::Skeleton pointer from which to create the osg skeleton
axisLengthLength of the joint axes (meters)
debugDebug flag for printing debug statements to standard error

Member Function Documentation

void SkeletonNode::_addCollisionShapesFromBodyNode ( const dart::dynamics::BodyNode &  node) [protected]

Convert BodyNode collision shapes to osg shapes.

Parameters:
nodeBodyNode to get the collision shapes from
Returns:
void
void SkeletonNode::_addSkeletonObjectsRecursivley ( const dart::dynamics::BodyNode &  bodyNode) [protected]

Recursively build osg skeleton starting with a BodyNode and recursively creating its children. An osg::MatrixTransform get created whose transform corresponds to the BodyNode's world transform and then an osg::Group node gets created from the BodyNode's shape information and get put inside the osg::MatrixTransform. Finally the osg::MatrixTransform gets added as a child to the root node of the SkeletonNode and it will recursively add osg::MatrixTransforms and Geode for all the children.

Parameters:
bodyNodeThe BodyNode to add to the osg skeleton along with its children
void SkeletonNode::_addSkeletonVisuals ( ) [protected]

Add visual elements of skeleton that can be toggled on or off, such as the center of mass.

Returns:
void
void SkeletonNode::_addVisualizationShapesFromBodyNode ( const dart::dynamics::BodyNode &  node) [protected]

Convert BodyNode visualization shapes to osg shapes.

Parameters:
nodeBodyNode to get shapes from
Returns:
void
void SkeletonNode::_createSkeleton ( ) [protected]

Create the osg skeleton from the root BodyNode by traversing its children and creating osg::Nodes for each physical BodyNode and putting them inside a osg::MatrixTransform with it transform set to the BodyNode's world transform.

Parameters:
rootBodyNodeThe root of the skeleton
Returns:
void
osg::Group * SkeletonNode::_makeBodyNodeCollisionMeshGroup ( const dart::dynamics::BodyNode &  node) [protected]

Create osg::Group* object from a dart::dynamics::BodyNode passed in by reference. It generates the shape information in an OpenSceneGraph format, looping through the BodyNode's collision shapes and converting them from aiScene objects to osg::Node objects and adding them as children to the BodyNode osg::Group.

Parameters:
nodeconst dart::dynamics::BodyNode reference of which to make an osg::Group*
Returns:
osg::Group* The osg::Group* corresponding to the dart::dynamics::BodyNode's collision shape
osg::Group * SkeletonNode::_makeBodyNodeGroup ( const dart::dynamics::BodyNode &  node) [protected]

Create osg::Group* object from a dart::dynamics::BodyNode passed in by reference. It generates the shape information in an OpenSceneGraph format, looping through the BodyNode's visualization shapes and converting them from aiScene objects to osg::Node objects and adding them as children to the BodyNode osg::Group.

Parameters:
nodedart::dynamics::BodyNode of which to make an osg::Group*
Returns:
osg::Group* The osg::Group* corresponding to the dart::dynamics::BodyNode
osgDart::BodyNodeVisuals * SkeletonNode::_makeBodyNodeVisuals ( const dart::dynamics::BodyNode &  node) [protected]

Create an osgDart::BodyNodeVisuals* object from a dart::dynamics::BodyNode passed in by reference. It generates the BodyNode specific visuals such as link frame and joint axis for the passed-in BodyNode.

Parameters:
nodeconst dart::dynamics::BodyNode reference for which to create visuals.
Returns:
osgDart::BodyNodeVisuals pointer corresponding to the BodyNode's osg visuals
void SkeletonNode::_updateRecursively ( const dart::dynamics::BodyNode &  bodyNode) [protected]

Update SkeletonNode recursively based on Skeleton transforms. This traverses through each BodyNode and its child BodyNodes and updates corresponding osg::MatrixTransform based on their current world transform.

Parameters:
bodyNodeBodyNode used to update the osg::MatrixTransform and its children
Returns:
void

Updates the skeleton visuals.

Returns:
void
const dart::dynamics::BodyNode & SkeletonNode::getRootBodyNode ( )

Get root body node.

Returns:
dart::dynamics::BodyNode pointer to the root body node
void SkeletonNode::setBodyNodeAxesVisible ( bool  makeVisible = false)

Shows or hides the individual link frames, represented by x,y,z axes using the color scheme red, green, blue, respectively. Currently this function doesn't account for different sized objects so axes may not be visible for larger objects.

Parameters:
makeVisibleWhether or not to visualize the link axes
Returns:
void
void osgDart::SkeletonNode::setBodyNodeCoMVisible ( bool  makeVisible = false)

Shows or hides the individual link center of masses, represented by a sphere. Currently not implemented.

Parameters:
makeVisibleWhether or not to visualize link center of masses
Returns:
void
void SkeletonNode::setBodyNodeTransparency ( const dart::dynamics::BodyNode &  node,
float  transparencyValue 
)

Sets the transparency value of the specified BodyNode.

Parameters:
nodedart::dynamics::BodyNode of which to set the transparency
transparencyValueNew transparency value for the node
Returns:
void
void SkeletonNode::setJointAxesVisible ( bool  makeVisible = false)

Shows or hides the individual joint axes. This applies to skeletons with more than one link. A single line with an arrow is displayed representing the axis of rotation of the joint. This currently only applies to revolute joints.

Parameters:
makeVisibleWhether or not to visualize the joint axes
Returns:
void
void SkeletonNode::setSkeletonCoMProjectedVisible ( bool  makeVisible = false)

Shows or hides the skeleton's projected center of mass, represented by a circle on the ground.

Parameters:
makeVisibleWhether or not to visualize the skeleton's projected center of mass
Returns:
void
void SkeletonNode::setSkeletonCoMVisible ( bool  makeVisible = false)

Shows or hides the skeleton's center of mass, represented by a sphere.

Parameters:
makeVisibleWhether or not to visualize the skeleton's center of mass
Returns:
void

Set the render mode of the Skeleton.

Parameters:
renderModeThe render mode specified by the enumeration, renderMode_t
Returns:
void

Update SkeletonNode MatrixTransforms based on the dart::Skeleton BodyNode world transforms. This is done recursively by traversing through the Skeleton bodyNodes and their children.

Returns:
void

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator