Moby
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
Moby::RigidBody Class Reference

Represents a single rigid body. More...

#include <RigidBody.h>

Inheritance diagram for Moby::RigidBody:
Moby::ControlledBody Moby::Visualizable Moby::Base

Public Types

enum  Compliance { eRigid, eCompliant }
 

Public Member Functions

 RigidBody ()
 Default constructor. More...
 
virtual void set_visualization_data (osg::Node *vdata)
 Sets the visualization data from a node.
 
virtual void load_from_xml (boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
 Implements Base::load_from_xml()
 
virtual void save_to_xml (XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
 Implements Base::save_to_xml()
 
bool is_child_link (boost::shared_ptr< const RigidBody > query) const
 Determines whether the given link is a child link of this.
 
bool is_descendant_link (boost::shared_ptr< const RigidBody > query) const
 Determines whether the given link is a descendant of this. More...
 
RigidBodyPtr get_parent_link () const
 Gets the first parent link of this link; returns NULL if there is no parent.
 
JointPtr get_inner_joint_explicit () const
 Gets the explicit inner joint of this link; returns NULL if there is no explicit inner joint. More...
 
virtual void prepare_to_calc_ode (Ravelin::SharedConstVectorNd &x, double t, double dt, void *data)
 Prepares to compute the ODE.
 
virtual void prepare_to_calc_ode_sustained_constraints (Ravelin::SharedConstVectorNd &x, double t, double dt, void *data)
 Prepares to compute the derivative of the body (sustained constraints)
 
virtual void ode (double t, double dt, void *data, Ravelin::SharedVectorNd &dx)
 Computes the ODE.
 
virtual void set_articulated_body (boost::shared_ptr< ArticulatedBody > body)
 Sets the articulated body corresponding to this body. More...
 
virtual void set_inertia (const Ravelin::SpatialRBInertiad &J)
 Sets the rigid body inertia for this body.
 
virtual void apply_generalized_impulse (const Ravelin::SharedVectorNd &gj)
 Applies a generalized impulse to the rigid body (calls the simulator)
 
template<class OutputIterator >
OutputIterator get_parent_links (OutputIterator begin) const
 
template<class OutputIterator >
OutputIterator get_child_links (OutputIterator begin) const
 
template<class OutputIterator >
OutputIterator get_parent_links (OutputIterator begin) const
 
template<class OutputIterator >
OutputIterator get_child_links (OutputIterator begin) const
 
- Public Member Functions inherited from Moby::ControlledBody
const std::list
< RecurrentForcePtr > & 
get_recurrent_forces () const
 Gets the set of recurrent forces applied to this body.
 
std::list< RecurrentForcePtr > & get_recurrent_forces ()
 Gets the set of recurrent forces applied to this body.
 
- Public Member Functions inherited from Moby::Visualizable
 Visualizable (const Visualizable *v)
 
virtual void update_visualization ()
 Updates the visualization using the appropriate transform. More...
 
void set_visualization_relative_pose (const Ravelin::Pose3d &P)
 Sets the visualization relative pose.
 
virtual void set_visualization_data (OSGGroupWrapperPtr vdata)
 Sets the visualization data from a OSGGroupWrapper.
 
osg::Group * get_visualization_data () const
 Gets the visualization data for this object.
 
boost::shared_ptr< const
Ravelin::Pose3d > 
get_visualization_pose ()
 Gets the pose for this visualizable object.
 
- Public Member Functions inherited from Moby::Base
 Base (const Base *b)
 

Public Attributes

std::list< CollisionGeometryPtrgeometries
 Collision geometries, if any, for this rigid body.
 
Compliance compliance
 Compliance value, determines event type.
 
- Public Attributes inherited from Moby::ControlledBody
Ravelin::VectorNd &(* controller )(boost::shared_ptr< ControlledBody > body, Ravelin::VectorNd &, double, void *)
 The controller callback, if any, for this body.
 
void * controller_arg
 Argument to be passed to the controller.
 
- Public Attributes inherited from Moby::Base
boost::shared_ptr< void > userdata
 Any relevant userdata.
 
std::string id
 The unique ID for this object.
 

Friends

class ArticulatedBody
 
class RCArticulatedBody
 
class MCArticulatedBody
 
class TimeSteppingSimulator
 
class Joint
 

Additional Inherited Members

- Static Public Member Functions inherited from Moby::Visualizable
static osg::Group * construct_from_node (boost::shared_ptr< const XMLTree > node, const std::map< std::string, BasePtr > &id_map)
 Utility method for load_from_xml() More...
 
- Static Public Member Functions inherited from Moby::Base
template<class T >
static boost::shared_ptr< T > clone (boost::shared_ptr< T > x)
 Static method for cloning a shared pointer.
 
- Protected Attributes inherited from Moby::ControlledBody
boost::weak_ptr< Simulatorsimulator
 Pointer to the simulator (necessary for applying impulses w/constraints)
 
- Protected Attributes inherited from Moby::Visualizable
boost::shared_ptr
< Ravelin::Pose3d > 
_vF
 The relative pose.
 
OSGGroupWrapperPtr _vizdata
 The underlying visualization data.
 

Detailed Description

Represents a single rigid body.

Contains information needed to represent a rigid body, including position and velocity (both linear and angular), mass, center of mass, inertia matrix, collision data, and visualization data. This class is used for both non-articulated and articulated rigid bodies, though not all member data may be used in the latter.

Todo:
implement rest matrix

Constructor & Destructor Documentation

RigidBody::RigidBody ( )

Default constructor.

Constructs a rigid body with zero mass, zero inertia tensor, and center of mass at [0,0,0] with position at [0,0,0], identity orientation, and zero linear and angular velocity. Body is enabled by default.

Member Function Documentation

JointPtr RigidBody::get_inner_joint_explicit ( ) const

Gets the explicit inner joint of this link; returns NULL if there is no explicit inner joint.

Throws an exception if this link has multiple explicit inner joints

bool RigidBody::is_descendant_link ( boost::shared_ptr< const RigidBody query) const

Determines whether the given link is a descendant of this.

Note
returns true if query == this
void RigidBody::set_articulated_body ( boost::shared_ptr< ArticulatedBody body)
virtual

Sets the articulated body corresponding to this body.

Parameters
bodya pointer to the articulated body or NULL if this body is not a link in an articulated body

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