OpenSim::Body Class Reference

A class implementing a Simbody rigid body. More...

#include <Body.h>

Inheritance diagram for OpenSim::Body:
OpenSim::ModelComponent OpenSim::Object

List of all members.

Public Member Functions

virtual ~Body ()
 Destructor.
 Body ()
 Default constructor.
 Body (const std::string &aName, double aMass, const SimTK::Vec3 &aMassCenter, const SimTK::Inertia &aInertia)
 Constructor.
 Body (const Body &aBody)
 Copy constructor.
virtual Objectcopy () const
 Copy constructor from an AbstractBody.
Bodyoperator= (const Body &aBody)
 Assignment operator.
void copyData (const Body &aBody)
 Copy data members from one Body to another.
virtual void addDisplayGeometry (const std::string &aGeometryFileName)
 Add display geometry to body.
virtual double getMass () const
 Get the mass of the body.
virtual bool setMass (double aMass)
 Set the mass of the body.
virtual void getMassCenter (SimTK::Vec3 &rVec) const
 Get the mass center of the body.
virtual bool setMassCenter (const SimTK::Vec3 &aVec)
 Set the mass center of the body.
virtual void getInertia (SimTK::Mat33 &rInertia) const
 Get the inertia matrix of the body.
virtual bool setInertia (const SimTK::Inertia &aInertia)
 Set the inertia matrix of the body.
virtual bool hasJoint () const
virtual JointgetJoint () const
virtual void setJoint (Joint &aJoint)
 Set the joint for this body.
virtual void scale (const SimTK::Vec3 &aScaleFactors, bool aScaleMass=false)
 Scale the body.
virtual void scaleInertialProperties (const SimTK::Vec3 &aScaleFactors, bool aScaleMass=true)
 Scale the body's mass and inertia tensor.
virtual void scaleMass (double aScaleFactor)
 Scale the body's mass and inertia tensor (represents a scaling of the body's density).
virtual const VisibleObjectgetDisplayer () const
virtual VisibleObjectupdDisplayer ()
virtual const
SimTK::MobilizedBodyIndex 
getIndex () const
void getScaleFactors (SimTK::Vec3 &aScaleFactors) const
WrapObjectgetWrapObject (const std::string &aName) const
const WrapObjectSetgetWrapObjectSet () const
 OPENSIM_DECLARE_DERIVED (Body, Object)
SimTK::MassProperties getMassProperties ()
 Assemble body interial properties: mass, center of mass location, moment of inertia about the origin of the body and return as a SimTK::MassProperties.
virtual int getNumStateVariables () const
 Gets the number of "Continuous" state variables maintained by the ModelComponent If the ModelComponent defines any that are of interest to the user, names should also be given.

Protected Member Functions

virtual void setup (Model &aModel)
 Perform some set up functions that happen after the object has been deserialized or copied.
virtual void createSystem (SimTK::MultibodySystem &system) const
 This is called when a SimTK System is being created for the Model.
virtual void initState (SimTK::State &state) const
 This is called after a SimTK System and State have been created for the Model.
virtual void setDefaultsFromState (const SimTK::State &state)
 Set all default values for this object to match those in a specified State.

Protected Attributes

PropertyDbl _massProp
 Mass of the body.
double & _mass
PropertyDblVec3 _massCenterProp
 Mass center of body.
SimTK::Vec3 & _massCenter
PropertyDbl _inertiaXXProp
 Moment of inertia Ixx computed with respect to the body's center of mass.
double & _inertiaXX
PropertyDbl _inertiaYYProp
 Moment of inertia Iyy computed with respect to the body's center of mass.
double & _inertiaYY
PropertyDbl _inertiaZZProp
 Moment of inertia Izz computed with respect to the body's center of mass.
double & _inertiaZZ
PropertyDbl _inertiaXYProp
 Product of inertia Ixy computed with respect to the body's center of mass.
double & _inertiaXY
PropertyDbl _inertiaXZProp
 Product of inertia Ixz computed with respect to the body's center of mass.
double & _inertiaXZ
PropertyDbl _inertiaYZProp
 Product of inertia Iyz computed with respect to the body's center of mass.
double & _inertiaYZ
PropertyObjPtr< Joint_jointProp
 Joint connecting this body with the parent body.
Joint *& _joint
PropertyObj _displayerProp
 For display of the body.
VisibleObject_displayer
PropertyObj _wrapObjectSetProp
 Set containing the wrap objects attached to this body.
WrapObjectSet_wrapObjectSet
SimTK::MobilizedBodyIndex _index
 ID for the body in Simbody.

Friends

class Joint

Detailed Description

A class implementing a Simbody rigid body.

Author:
Frank C. Anderson, Ajay Seth
Version:
1.0

Constructor & Destructor Documentation

Body::~Body (  )  [virtual]

Destructor.

Body::Body (  ) 

Default constructor.

Body::Body ( const std::string &  aName,
double  aMass,
const SimTK::Vec3 &  aMassCenter,
const SimTK::Inertia &  aInertia 
)

Constructor.

Body::Body ( const Body aBody  ) 

Copy constructor.

Parameters:
aBody Body to be copied.

Member Function Documentation

void Body::addDisplayGeometry ( const std::string &  aGeometryFileName  )  [virtual]

Add display geometry to body.

Parameters:
aGeometryFileName Geometry filename.
Object * Body::copy (  )  const [virtual]

Copy constructor from an AbstractBody.

Parameters:
aBody Body to be copied.

Body::Body(const AbstractBody &aBody) : AbstractBody(aBody), _mass(_massProp.getValueDbl()), _massCenter(_massCenterProp.getValueDblVec()), _inertiaXX(_inertiaXXProp.getValueDbl()), _inertiaYY(_inertiaYYProp.getValueDbl()), _inertiaZZ(_inertiaZZProp.getValueDbl()), _inertiaXY(_inertiaXYProp.getValueDbl()), _inertiaXZ(_inertiaXZProp.getValueDbl()), _inertiaYZ(_inertiaYZProp.getValueDbl()), _joint(_jointProp.getValueObjPtrRef()), _displayerProp(PropertyObj("", VisibleObject())), _displayer((VisibleObject&)_displayerProp.getValueObj()) { setNull(); setupProperties(); copyData(aBody); } Copy this body and return a pointer to the copy. The copy constructor for this class is used.

Returns:
Pointer to a copy of this Body.

Reimplemented from OpenSim::Object.

void Body::copyData ( const Body aBody  ) 

Copy data members from one Body to another.

Parameters:
aBody Body to be copied.
void Body::createSystem ( SimTK::MultibodySystem &  system  )  const [protected, virtual]

This is called when a SimTK System is being created for the Model.

It must be implemented to add appropriate elements to the System corresponding to this object. Methods for adding modeling options, state variables and their derivatives, discrete variables, as well must be called with createSystem() only.

Parameters:
system the System being created

Reimplemented from OpenSim::ModelComponent.

virtual const VisibleObject* OpenSim::Body::getDisplayer (  )  const [inline, virtual]

Reimplemented from OpenSim::Object.

virtual const SimTK::MobilizedBodyIndex OpenSim::Body::getIndex (  )  const [inline, virtual]
void Body::getInertia ( SimTK::Mat33 &  rInertia  )  const [virtual]

Get the inertia matrix of the body.

Parameters:
3x3 inertia matrix.
Joint & Body::getJoint (  )  const [virtual]
double Body::getMass (  )  const [virtual]

Get the mass of the body.

Returns:
Mass of body from Simbody code.
void Body::getMassCenter ( SimTK::Vec3 &  rVec  )  const [virtual]

Get the mass center of the body.

Parameters:
rVec XYZ coordinates of mass center are returned here.
SimTK::MassProperties Body::getMassProperties (  ) 

Assemble body interial properties: mass, center of mass location, moment of inertia about the origin of the body and return as a SimTK::MassProperties.

virtual int OpenSim::Body::getNumStateVariables (  )  const [inline, virtual]

Gets the number of "Continuous" state variables maintained by the ModelComponent If the ModelComponent defines any that are of interest to the user, names should also be given.

Implements OpenSim::ModelComponent.

void Body::getScaleFactors ( SimTK::Vec3 &  aScaleFactors  )  const
WrapObject* OpenSim::Body::getWrapObject ( const std::string &  aName  )  const
const WrapObjectSet& OpenSim::Body::getWrapObjectSet (  )  const [inline]
virtual bool OpenSim::Body::hasJoint (  )  const [inline, virtual]
virtual void OpenSim::Body::initState ( SimTK::State &  state  )  const [inline, protected, virtual]

This is called after a SimTK System and State have been created for the Model.

It must be implementd to set initial values of state variables.

Parameters:
state the State to initialize

Reimplemented from OpenSim::ModelComponent.

OpenSim::Body::OPENSIM_DECLARE_DERIVED ( Body  ,
Object   
)
Body & Body::operator= ( const Body aBody  ) 

Assignment operator.

Returns:
Reference to this object.

Reimplemented from OpenSim::ModelComponent.

void Body::scale ( const SimTK::Vec3 &  aScaleFactors,
bool  aScaleMass = false 
) [virtual]

Scale the body.

Parameters:
aScaleFactors XYZ scale factors.
aScaleMass whether or not to scale mass properties
void Body::scaleInertialProperties ( const SimTK::Vec3 &  aScaleFactors,
bool  aScaleMass = true 
) [virtual]

Scale the body's mass and inertia tensor.

Parameters:
aScaleFactors XYZ scale factors.
aScaleMass Whether or not to scale the mass
void Body::scaleMass ( double  aScaleFactor  )  [virtual]

Scale the body's mass and inertia tensor (represents a scaling of the body's density).

Parameters:
aScaleFactors XYZ scale factors.
virtual void OpenSim::Body::setDefaultsFromState ( const SimTK::State &  state  )  [inline, protected, virtual]

Set all default values for this object to match those in a specified State.

It must be implemented/overriden to set any default values defined by each subclass.

Parameters:
state the State from which to take values that should become the defaults for this object

Reimplemented from OpenSim::ModelComponent.

bool Body::setInertia ( const SimTK::Inertia &  aInertia  )  [virtual]

Set the inertia matrix of the body.

Parameters:
aInertia 9-element inertia matrix.
Returns:
Whether inertia matrix was successfully changed.
void Body::setJoint ( Joint aJoint  )  [virtual]

Set the joint for this body.

Parameters:
aJoint Joint connecting this body to the parent body.
bool Body::setMass ( double  aMass  )  [virtual]

Set the mass of the body.

Parameters:
aMass mass of body.
Returns:
Whether mass was successfully changed.
bool Body::setMassCenter ( const SimTK::Vec3 &  aVec  )  [virtual]

Set the mass center of the body.

Parameters:
aVec XYZ coordinates of mass center.
Returns:
Whether mass center was successfully changed.
void Body::setup ( Model aModel  )  [protected, virtual]

Perform some set up functions that happen after the object has been deserialized or copied.

Parameters:
aModel OpenSim model containing this Body.

Reimplemented from OpenSim::ModelComponent.

virtual VisibleObject* OpenSim::Body::updDisplayer (  )  [inline, virtual]

Reimplemented from OpenSim::Object.


Friends And Related Function Documentation

friend class Joint [friend]

Member Data Documentation

For display of the body.

SimTK::MobilizedBodyIndex OpenSim::Body::_index [protected]

ID for the body in Simbody.

double& OpenSim::Body::_inertiaXX [protected]

Moment of inertia Ixx computed with respect to the body's center of mass.

double& OpenSim::Body::_inertiaXY [protected]

Product of inertia Ixy computed with respect to the body's center of mass.

double& OpenSim::Body::_inertiaXZ [protected]

Product of inertia Ixz computed with respect to the body's center of mass.

double& OpenSim::Body::_inertiaYY [protected]

Moment of inertia Iyy computed with respect to the body's center of mass.

double& OpenSim::Body::_inertiaYZ [protected]

Product of inertia Iyz computed with respect to the body's center of mass.

double& OpenSim::Body::_inertiaZZ [protected]

Moment of inertia Izz computed with respect to the body's center of mass.

Joint* & OpenSim::Body::_joint [protected]

Joint connecting this body with the parent body.

double& OpenSim::Body::_mass [protected]
SimTK::Vec3& OpenSim::Body::_massCenter [protected]

Mass center of body.

Mass of the body.

Set containing the wrap objects attached to this body.


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

Generated on Sun Sep 25 00:20:01 2011 for OpenSim by  doxygen 1.6.1