A class implementing a Simbody rigid body. More...
#include <Body.h>
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 Object * | copy () const |
Copy constructor from an AbstractBody. | |
Body & | operator= (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 Joint & | getJoint () 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 VisibleObject * | getDisplayer () const |
virtual VisibleObject * | updDisplayer () |
virtual const SimTK::MobilizedBodyIndex | getIndex () const |
void | getScaleFactors (SimTK::Vec3 &aScaleFactors) const |
WrapObject * | getWrapObject (const std::string &aName) const |
const WrapObjectSet & | getWrapObjectSet () 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 |
A class implementing a Simbody rigid body.
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.
void Body::addDisplayGeometry | ( | const std::string & | aGeometryFileName | ) | [virtual] |
Add display geometry to body.
aGeometryFileName | Geometry filename. |
Object * Body::copy | ( | ) | const [virtual] |
Copy constructor from an AbstractBody.
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.
Reimplemented from OpenSim::Object.
void Body::copyData | ( | const Body & | aBody | ) |
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.
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.
3x3 | inertia matrix. |
Joint & Body::getJoint | ( | ) | const [virtual] |
double Body::getMass | ( | ) | const [virtual] |
Get the mass of the body.
void Body::getMassCenter | ( | SimTK::Vec3 & | rVec | ) | const [virtual] |
Get the mass center of the body.
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.
state | the State to initialize |
Reimplemented from OpenSim::ModelComponent.
void Body::scale | ( | const SimTK::Vec3 & | aScaleFactors, | |
bool | aScaleMass = false | |||
) | [virtual] |
Scale the body.
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.
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).
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.
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.
aInertia | 9-element inertia matrix. |
void Body::setJoint | ( | Joint & | aJoint | ) | [virtual] |
bool Body::setMass | ( | double | aMass | ) | [virtual] |
Set the mass of the body.
aMass | mass of body. |
bool Body::setMassCenter | ( | const SimTK::Vec3 & | aVec | ) | [virtual] |
Set the mass center of the body.
aVec | XYZ coordinates of mass center. |
void Body::setup | ( | Model & | aModel | ) | [protected, virtual] |
Perform some set up functions that happen after the object has been deserialized or copied.
aModel | OpenSim model containing this Body. |
Reimplemented from OpenSim::ModelComponent.
virtual VisibleObject* OpenSim::Body::updDisplayer | ( | ) | [inline, virtual] |
Reimplemented from OpenSim::Object.
friend class Joint [friend] |
VisibleObject& OpenSim::Body::_displayer [protected] |
PropertyObj OpenSim::Body::_displayerProp [protected] |
For display of the body.
SimTK::MobilizedBodyIndex OpenSim::Body::_index [protected] |
ID for the body in Simbody.
double& OpenSim::Body::_inertiaXX [protected] |
PropertyDbl OpenSim::Body::_inertiaXXProp [protected] |
Moment of inertia Ixx computed with respect to the body's center of mass.
double& OpenSim::Body::_inertiaXY [protected] |
PropertyDbl OpenSim::Body::_inertiaXYProp [protected] |
Product of inertia Ixy computed with respect to the body's center of mass.
double& OpenSim::Body::_inertiaXZ [protected] |
PropertyDbl OpenSim::Body::_inertiaXZProp [protected] |
Product of inertia Ixz computed with respect to the body's center of mass.
double& OpenSim::Body::_inertiaYY [protected] |
PropertyDbl OpenSim::Body::_inertiaYYProp [protected] |
Moment of inertia Iyy computed with respect to the body's center of mass.
double& OpenSim::Body::_inertiaYZ [protected] |
PropertyDbl OpenSim::Body::_inertiaYZProp [protected] |
Product of inertia Iyz computed with respect to the body's center of mass.
double& OpenSim::Body::_inertiaZZ [protected] |
PropertyDbl OpenSim::Body::_inertiaZZProp [protected] |
Moment of inertia Izz computed with respect to the body's center of mass.
Joint* & OpenSim::Body::_joint [protected] |
PropertyObjPtr<Joint> OpenSim::Body::_jointProp [protected] |
Joint connecting this body with the parent body.
double& OpenSim::Body::_mass [protected] |
SimTK::Vec3& OpenSim::Body::_massCenter [protected] |
PropertyDblVec3 OpenSim::Body::_massCenterProp [protected] |
Mass center of body.
PropertyDbl OpenSim::Body::_massProp [protected] |
Mass of the body.
WrapObjectSet& OpenSim::Body::_wrapObjectSet [protected] |
PropertyObj OpenSim::Body::_wrapObjectSetProp [protected] |
Set containing the wrap objects attached to this body.