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::DartNode Class Reference

Class that is a subclass of osg::Group, which is the main object for DART visualization in OpenSceneGraph. It can contain many SkeletonNodes as parts of a simulation world. In essence, a DartNode is the largest visualization object. More...

#include <DartNode.h>

List of all members.

Public Member Functions

 DartNode (bool debug=false)
 Constructor for DartNode.
void _updateContactForces ()
 Creates arrows for contact forces in the world during simulation.
void setContactForcesVisible (bool makeVisible)
 Toggles contact forces visibility on/off.
dart::dynamics::Skeleton * parseSkeletonUrdf (std::string urdfFile)
 Create a dart::dynamics::Skeleton pointer from a skeleton urdf file using DART's DartLoader.
dart::simulation::World * parseWorldSdf (std::string sdfFile)
 Create a dart::simulation::World pointer from a world sdf file using DART's Sdf parser.
dart::simulation::World * parseWorldUrdf (std::string urdfFile)
 Create a dart::simulation::World pointer from a world urdf file using DART's DartLoader.
int addWorldFromUrdf (std::string urdfFile)
 Add a dart::simulation::World to the DartNode using the name of a world urdf file.
size_t addWorldFromSdf (std::string sdfFile)
 Add a dart::simulation::World to the DartNode using the name of a world sdf file.
size_t addWorld (std::string file)
 Add dart::simulation::World to the DartNode using the name of a world file.
size_t addSkeleton (std::string urdfFile)
 Add a dart::dynamics::Skeleton to the DartNode using the name of a skeleton urdf file.
size_t addSkeleton (dart::dynamics::Skeleton &skeleton)
 Add a skeleton to the DartNode.
size_t addWorld (dart::simulation::World *world)
 Add a world to the DartNode. The world may consist of one or more objects or skeletons, all represented as Skeletons, each with a world transformation.
dart::dynamics::Skeleton * getSkeleton (size_t skeletonIndex=0)
 Get skeleton via index (size_t)
int removeSkeleton (const dart::dynamics::Skeleton *skeletonToRemove)
 Remove skeleton from DartNode by passing in the pointer to the dart::dynamics::Skeleton to be removed.
int removeSkeleton (size_t skeletonIndex=0)
 Remove skeleton from DartNode by passing in the index of the skeleton to be removed.
void reset ()
 Clear the DartNode. This is used for when you want to start from scratch but don't want to delete and create a new DartNode.
dart::simulation::World * getWorld ()
 Get a pointer to the World object in the DartNode.
size_t getNumSkeletons ()
 Get number of skeletons in the DartNode.
void printInfo ()
 Print out meta information of the skeleton.
void update ()
 Updates the transforms of all the dart objects in the SkeletonNodes of the DartNode for the next culling and drawing events.
void setSkeletonTransparency (const dart::dynamics::Skeleton &skel, float transparencyValue)
 Sets the transparency value of the SkeletonNode corresponding to the dart::dynamics::Skeleton passed in.
void setBodyNodeTransparency (const dart::dynamics::BodyNode &node, float transparencyValue)
 Sets the transparency value of the osg::Group corresponding to the dart::dynamics::BodyNode passed in.
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 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 setSkeletonCollisionMeshOn (bool enable=true)
 Render the skeleton using the collision mesh instead of the visual mesh.
void setSkeletonWireFrameOn (bool enable=true)
 Render the skeleton using wireframe instead of fill mode.
void hideSkeleton (int i)
 Hide a skeleton.

Protected Member Functions

int skeletonIndexIsValid (size_t skeletonIndex)
 Helper function to determine if the index the user passed in to specify a skeleton is valid.

Protected Attributes

dart::simulation::World * _world
 Standard vector of pointers to Skeletons.
std::vector
< dart::dynamics::Skeleton * > 
_skeletons
 Standard vector of pointers to dart::dynamics::Skeleton objects.
std::vector< osg::ref_ptr
< SkeletonNode > > 
_skeletonNodes
 Standard vector of pointers to SkeletonNode objects.
SkeletonNodeMap _skelNodeMap
 Map from dart::dynamics::Skeleton* to osg::SkeletonNode.
std::vector< osg::ref_ptr
< osgDart::ContactForceVisual > > 
_contactForceArrows
 Array of osg::MatrixTransforms representing contactForces in the world.
const bool _debug
 Debug variable for whether or not to print debug output.
bool _showContactForces
 Whether or not to show the contact forces in the visualization.

Detailed Description

Class that is a subclass of osg::Group, which is the main object for DART visualization in OpenSceneGraph. It can contain many SkeletonNodes as parts of a simulation world. In essence, a DartNode is the largest visualization object.


Member Function Documentation

Creates arrows for contact forces in the world during simulation.

Returns:
void
size_t DartNode::addSkeleton ( std::string  urdfFile)

Add a dart::dynamics::Skeleton to the DartNode using the name of a skeleton urdf file.

Parameters:
urdfFileThe name of the urdf file
Returns:
Index value of the added skeleton.
size_t DartNode::addSkeleton ( dart::dynamics::Skeleton &  skeleton)

Add a skeleton to the DartNode.

Parameters:
skeletonNew skeleton to add to the DartNode
Returns:
Index (size_t) of the newly added skeleton
size_t DartNode::addWorld ( std::string  file)

Add dart::simulation::World to the DartNode using the name of a world file.

Parameters:
fileFile name of a urdf or sdf
Returns:
Number of skeletons in the DartNode.
size_t DartNode::addWorld ( dart::simulation::World *  world)

Add a world to the DartNode. The world may consist of one or more objects or skeletons, all represented as Skeletons, each with a world transformation.

Parameters:
worldThe dart::simulation::World object passed in by reference that contains one or more dart::dynamics::Skeleton objects.
Returns:
Index of the last object added
size_t DartNode::addWorldFromSdf ( std::string  sdfFile)

Add a dart::simulation::World to the DartNode using the name of a world sdf file.

Parameters:
sdfFileThe name of the sdf file
Returns:
Number of skeletons in the DartNode.
int osgDart::DartNode::addWorldFromUrdf ( std::string  urdfFile)

Add a dart::simulation::World to the DartNode using the name of a world urdf file.

Parameters:
urdfFileThe name of the urdf file
Returns:
A success/fail integer. 1 = Success. 0 = Fail.

Get number of skeletons in the DartNode.

Returns:
size_t Number of skeletons in the DartNode
dart::dynamics::Skeleton * DartNode::getSkeleton ( size_t  skeletonIndex = 0)

Get skeleton via index (size_t)

Parameters:
skeletonIndexIndex of the skeleton you want
Returns:
a dart::dynamics::Skeleton skeleton
dart::simulation::World * DartNode::getWorld ( )

Get a pointer to the World object in the DartNode.

Returns:
simulation::World pointer
void DartNode::hideSkeleton ( int  i)

Hide a skeleton.

Parameters:
intskeleton index
Returns:
void
dart::dynamics::Skeleton * DartNode::parseSkeletonUrdf ( std::string  urdfFile)

Create a dart::dynamics::Skeleton pointer from a skeleton urdf file using DART's DartLoader.

Parameters:
urdfFileThe name of the urdf file
Returns:
Pointer to the dynamics::Skeleton object
dart::simulation::World * DartNode::parseWorldSdf ( std::string  sdfFile)

Create a dart::simulation::World pointer from a world sdf file using DART's Sdf parser.

Parameters:
sdfFileThe name of the world sdf file
Returns:
Pointer to the simulation::World object
dart::simulation::World * DartNode::parseWorldUrdf ( std::string  urdfFile)

Create a dart::simulation::World pointer from a world urdf file using DART's DartLoader.

Parameters:
urdfFileThe name of the urdf file
Returns:
Pointer to the simulation::World object

Print out meta information of the skeleton.

Parameters:
skeletonIndexIndex of the skeleton about which to print info
Returns:
void
int DartNode::removeSkeleton ( const dart::dynamics::Skeleton *  skeletonToRemove)

Remove skeleton from DartNode by passing in the pointer to the dart::dynamics::Skeleton to be removed.

Parameters:
skeletonskeleton to remove from the DartNode
Returns:
A success/fail integer. 1 = Success. 0 = Fail.
int DartNode::removeSkeleton ( size_t  skeletonIndex = 0)

Remove skeleton from DartNode by passing in the index of the skeleton to be removed.

Parameters:
skeletonskeleton to remove from the DartNode
Returns:
A success/fail integer. 1 = Success. 0 = Fail.
void DartNode::reset ( )

Clear the DartNode. This is used for when you want to start from scratch but don't want to delete and create a new DartNode.

Returns:
void
void DartNode::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 DartNode::setBodyNodeTransparency ( const dart::dynamics::BodyNode &  node,
float  transparencyValue 
)

Sets the transparency value of the osg::Group corresponding to the dart::dynamics::BodyNode passed in.

Parameters:
nodeBodyNode of which to change the transparency value of
transparencyValueNew transparency value for the BodyNode
Returns:
void
void DartNode::setContactForcesVisible ( bool  makeVisible)

Toggles contact forces visibility on/off.

Parameters:
makeVisibleWhether or not to make them visible
Returns:
void
void DartNode::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 DartNode::setSkeletonCollisionMeshOn ( bool  enable = true)

Render the skeleton using the collision mesh instead of the visual mesh.

Parameters:
enableWhether or not to enable the collision mesh
Returns:
void
void DartNode::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 DartNode::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
void DartNode::setSkeletonTransparency ( const dart::dynamics::Skeleton &  skel,
float  transparencyValue 
)

Sets the transparency value of the SkeletonNode corresponding to the dart::dynamics::Skeleton passed in.

Parameters:
skelSkeleton of which to change the transparency value of
transparencyValueNew transparency value for the skeleton
Returns:
void
void DartNode::setSkeletonWireFrameOn ( bool  enable = true)

Render the skeleton using wireframe instead of fill mode.

Parameters:
enableWhether or not to enable the wireframe mode
Returns:
void
int DartNode::skeletonIndexIsValid ( size_t  skeletonIndex) [protected]

Helper function to determine if the index the user passed in to specify a skeleton is valid.

Parameters:
skeletonIndexThe index of the desired skeleton
Returns:
A success/fail integer. 1 = Success. 0 = Fail.
void DartNode::update ( )

Updates the transforms of all the dart objects in the SkeletonNodes of the DartNode for the next culling and drawing events.

Returns:
void

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