SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
scl::CGraphicsChai Class Reference

#include <CGraphicsChai.hpp>

Inheritance diagram for scl::CGraphicsChai:
Inheritance graph
[legend]
Collaboration diagram for scl::CGraphicsChai:
Collaboration graph
[legend]

Public Member Functions

virtual sBool initGraphics (const SGraphicsParsed *arg_gr_ds)
 
virtual sBool initGraphics (const SGraphicsParsed *arg_gr_ds, SGraphicsChai *arg_chai_ds)
 
virtual sBool addRobotToRender (const SRobotParsed *arg_rob_parsed, const SRobotIO *arg_rob_io)
 
virtual sBool removeRobotFromRender (const std::string &arg_robot)
 
sBool addRobotLink (SGraphicsChaiRigidBody *arg_robot_link)
 
virtual sBool addMeshToRender (const std::string &arg_mesh_name, const std::string &arg_mesh_file, const Eigen::Vector3d &arg_pos, const Eigen::Matrix3d &arg_rot)
 
virtual sBool addMeshToParentInRender (const std::string &arg_mesh_name, const std::string &arg_parent_name, const std::string &arg_mesh_file, const Eigen::Vector3d &arg_pos, const Eigen::Matrix3d &arg_rot)
 
virtual sBool removeMeshFromRender (const std::string &arg_mesh_name)
 
sBool scaleMesh (const std::string &arg_mesh_name, sFloat arg_x, sFloat arg_y, sFloat arg_z)
 
virtual sBool addMusclesToRender (const std::string &arg_robot, const SActuatorSetMuscleParsed &arg_mset, const sBool add_musc_via_points)
 
virtual sBool removeMusclesFromRender (const std::string &arg_robot, const std::string &arg_mset)
 
sBool addSphereToRender (const std::string &arg_robot, const std::string &arg_link, const Eigen::Vector3d &arg_pos, const sFloat arg_size=0.01, chai3d::cGenericObject **arg_ret_ptr=S_NULL)
 
sBool addSphereToRender (const Eigen::Vector3d &arg_pos, chai3d::cGenericObject *&arg_ret_ptr, const sFloat arg_size=0.01)
 
sBool addBeltedEllipsoidToRender (const Eigen::Vector3d &arg_pos, chai3d::cGenericObject *&arg_ret_ptr, const sFloat arg_size=0.01)
 
virtual sBool destroyGraphics ()
 
virtual sBool updateGraphics ()
 
virtual sBool updateGraphicsForRobots ()
 
virtual sBool updateGraphicsForMeshes ()
 
virtual sBool updateGraphicsForMuscles ()
 
 CGraphicsChai ()
 
virtual ~CGraphicsChai ()
 
SGraphicsChaigetChaiData ()
 
const SGraphicsParsedgetParsedData ()
 
virtual sBool hasBeenInit ()
 
virtual bool hasBeenInit () const
 
virtual const std::string & getType () const
 
virtual const std::string & getName () const
 

Public Attributes

std::string name_
 
sBool has_been_init_
 

Protected Attributes

SGraphicsChaidata_
 
bool data_is_mine_
 
const SGraphicsParseddata_parsed_
 
std::string type_
 

Detailed Description

This is the interface for using chai graphics.

Enables rendering arbitrary scl robots.

Constructor & Destructor Documentation

scl::CGraphicsChai::CGraphicsChai ( )
inline

Default constructor. Sets stuff to NULL.

virtual scl::CGraphicsChai::~CGraphicsChai ( )
inlinevirtual

Default destructor. Does nothing

Member Function Documentation

sBool scl::CGraphicsChai::addBeltedEllipsoidToRender ( const Eigen::Vector3d &  arg_pos,
chai3d::cGenericObject *&  arg_ret_ptr,
const sFloat  arg_size = 0.01 
)

Adds a belted ellipsoid (representing the inertia at an operational point) to the rendering environment wrt the global frame

Parameters
arg_ret_ptrReference to a pointer, pass a pointer and get the object for your use
sBool scl::CGraphicsChai::addMeshToParentInRender ( const std::string &  arg_mesh_name,
const std::string &  arg_parent_name,
const std::string &  arg_mesh_file,
const Eigen::Vector3d &  arg_pos,
const Eigen::Matrix3d &  arg_rot 
)
virtual

Adds a static mesh to render. Indexed by its name.

A mesh is defined as anything that DOESN'T obey the laws of physics. It is merely rendered (possibly with collision etc).

The parent mesh MUST exist in the graphics world already.

sBool scl::CGraphicsChai::addMeshToRender ( const std::string &  arg_mesh_name,
const std::string &  arg_mesh_file,
const Eigen::Vector3d &  arg_pos,
const Eigen::Matrix3d &  arg_rot 
)
virtual

Adds a static mesh to render. Indexed by its name.

A mesh is defined as anything that DOESN'T obey the laws of physics. It is merely rendered (possibly with collision etc).

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::addMusclesToRender ( const std::string &  arg_robot,
const SActuatorSetMuscleParsed arg_mset,
const sBool  add_musc_via_points 
)
virtual

Adds a muscle system to the graphics rendering environment

A muscle system contains:

  1. A set of muscles, each with a set of connection points to certain links.
  2. A parent robot to whose links the muscles attach.
Parameters
arg_robotThe robot to which the muscles will be attached
arg_msetThe set of muscles to be attached

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::addRobotLink ( SGraphicsChaiRigidBody arg_robot_link)

Recursively adds links to the chai scenegraph (used by addRobotToRender() ).

  1. Creates a graphics object for a passed SGraphicsPhysicalLink* provided the parser data pointer is already set.
  2. Creates child objects for the passed SGraphicsPhysicalLink, sets their parser data pointers, and recursively sets them by calling itself.
sBool scl::CGraphicsChai::addRobotToRender ( const SRobotParsed arg_rob_parsed,
const SRobotIO arg_rob_io 
)
virtual

Adds a robot's meshes to the graphics rendering environment.

A robot is defined as:

  1. Anything whose dynamics are integrated by the physics simulator
  2. Any real world entity subject to the laws of physics
  • Tree structure built by this function: chai scenegraph root (Each child is a scl_util::CBranchingRepresentation<string, SGraphicsPhysicalLink>) | Robot Root / \ Links.. Links...

This tree structure allows selectively accessing the branching representations for different robots, and allows turning them on or off one-by-one.

Also, since we maintain different trees (chai, dynamics, parser-data etc..), we need some way to connect nodes between them. Each "SGraphicsChai data_" stores a pilemap of such trees in sutil::CMappedList< string, sutil::CMappedTree<string, SGraphicsPhysicalLink> > where the SGraphicsPhysicalLink object allows accessing links in all the different trees at one place.

Parameters
arg_rob_parsedThe static robot specification
arg_rob_ioThe generalized coordinates etc.

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::addSphereToRender ( const std::string &  arg_robot,
const std::string &  arg_link,
const Eigen::Vector3d &  arg_pos,
const sFloat  arg_size = 0.01,
chai3d::cGenericObject **  arg_ret_ptr = S_NULL 
)

Adds a sphere to a link on a robot in the rendering environment

Parameters
arg_ret_ptrGet the object for your use
sBool scl::CGraphicsChai::addSphereToRender ( const Eigen::Vector3d &  arg_pos,
chai3d::cGenericObject *&  arg_ret_ptr,
const sFloat  arg_size = 0.01 
)

Adds a sphere to the rendering environment wrt the global frame

Parameters
arg_ret_ptrReference to a pointer, pass a pointer and get the object for your use
sBool scl::CGraphicsChai::destroyGraphics ( )
virtual

Deallocates the chai world.

Implements scl::CGraphicsBase.

virtual const std::string& scl::SObject::getName ( ) const
inlinevirtualinherited

Get the object's type

virtual const std::string& scl::SObject::getType ( ) const
inlinevirtualinherited

Get the object's type

virtual bool scl::SObject::hasBeenInit ( ) const
inlinevirtualinherited

Get the object's type

virtual sBool scl::CGraphicsBase::hasBeenInit ( )
inlinevirtualinherited

Initialization state

virtual sBool scl::CGraphicsChai::initGraphics ( const SGraphicsParsed arg_gr_ds)
inlinevirtual

Initializes a graphics world using the camera information in the passed data structure.

Returns, true : Successfully created a world false : Failed (or the data structure was invalid).

Parameters
arg_gr_dsThe graphics data structure loaded from the xml file. Specifies camera etc. information.

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::initGraphics ( const SGraphicsParsed arg_gr_ds,
SGraphicsChai arg_chai_ds 
)
virtual

Initializes a graphics world using the camera information in the passed data structures.

Returns, true : Successfully created a world false : Failed (or the data structure was invalid).

position (eye)

lookat position (target)

"up" direction

Parameters
arg_gr_dsThe graphics data structure loaded from the xml file. Specifies camera etc. information.
arg_chai_dsThe graphics object to be used for computations. This allows someone else to (dynamically) allocate this object.
sBool scl::CGraphicsChai::removeMeshFromRender ( const std::string &  arg_mesh_name)
virtual

Removes a static mesh from the rendered scene. Indexed by its name.

A mesh is defined as anything that DOESN"T obey the laws of physics. It is merely rendered (possibly with collision etc).

Implements scl::CGraphicsBase.

virtual sBool scl::CGraphicsChai::removeMusclesFromRender ( const std::string &  arg_robot,
const std::string &  arg_mset 
)
inlinevirtual

Removes a muscle system from the graphics rendering environment

A muscle system is defined as:

  1. A set of line segments, with connection points on a robot links certain links.
  2. A parent robot to whose links the muscles attach.

NOTE TODO: Implement this.

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::removeRobotFromRender ( const std::string &  arg_robot)
virtual

Removes a robot's meshes from the graphics rendering environment.

A robot is defined as:

  1. Anything whose dynamics are integrated by the physics simulator
  2. Any real world entity subject to the laws of physics

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::scaleMesh ( const std::string &  arg_mesh_name,
sFloat  arg_x,
sFloat  arg_y,
sFloat  arg_z 
)

Scales a mesh along the x, y and z axes if it has been added to the rendering environment

sBool scl::CGraphicsChai::updateGraphics ( )
virtual

Updates the rotation and translation transformations for all the robots' and meshes' chai objects. ie. Updates all the CGenericObjects..

Implements scl::CGraphicsBase.

virtual sBool scl::CGraphicsChai::updateGraphicsForMeshes ( )
inlinevirtual

Updates the rotation and translation transformations for meshes' associated CGenerericObject branching chai representation. NOTE : Since meshes don't move themselves, this function does nothing. The meshes might move during user interaction sessions, but other code must update their frame transforms.

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::updateGraphicsForMuscles ( )
virtual

Updates the rotation and translation transformations for muscle systems' associated CGenerericObject branching chai representation.

Implements scl::CGraphicsBase.

sBool scl::CGraphicsChai::updateGraphicsForRobots ( )
virtual

Updates the rotation and translation transformations for robots' associated CGenerericObject branching chai representation.

Uncomment this if required:

Implements scl::CGraphicsBase.

Member Data Documentation

sBool scl::SObject::has_been_init_
inherited

Whether the object is ready for use

std::string scl::SObject::name_
inherited

The object's name

std::string scl::SObject::type_
protectedinherited

The object's type. Should only be set by the constructor


The documentation for this class was generated from the following files: