Choreonoid  1.5
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cnoid::Body Class Reference

#include <Body.h>

Inheritance diagram for cnoid::Body:
cnoid::Referenced cnoid::DyBody

Classes

struct  ExtraJoint
 

Public Types

enum  ExtraJointType { EJ_PISTON, EJ_BALL }
 

Public Member Functions

 Body ()
 
 Body (const Body &org)
 
virtual Bodyclone () const
 
virtual LinkcreateLink (const Link *org=0) const
 
virtual ~Body ()
 
const std::string & name () const
 
void setName (const std::string &name)
 
const std::string & modelName () const
 
void setModelName (const std::string &name)
 
void setRootLink (Link *link)
 
void updateLinkTree ()
 
void initializeState ()
 
int numJoints () const
 
int numVirtualJoints () const
 
int numAllJoints () const
 
Linkjoint (int id) const
 
int numLinks () const
 
Linklink (int index) const
 
const LinkTraverselinkTraverse () const
 
Linklink (const std::string &name) const
 
LinkrootLink () const
 
int numDevices () const
 
Devicedevice (int index) const
 
const DeviceListdevices () const
 
template<class DeviceType >
DeviceList< DeviceType > devices () const
 
template<class DeviceType >
DeviceType * findDevice (const std::string &name) const
 
DevicefindDevice (const std::string &name) const
 
void addDevice (Device *device)
 
void initializeDeviceStates ()
 
void clearDevices ()
 
bool isStaticModel () const
 
bool isFixedRootModel () const
 
void resetDefaultPosition (const Position &T)
 
const PositiondefaultPosition () const
 
double mass () const
 
const Vector3calcCenterOfMass ()
 
const Vector3centerOfMass () const
 
void calcTotalMomentum (Vector3 &out_P, Vector3 &out_L)
 
void calcForwardKinematics (bool calcVelocity=false, bool calcAcceleration=false)
 
void clearExternalForces ()
 
int numExtraJoints () const
 
ExtraJointextraJoint (int index)
 
const ExtraJointextraJoint (int index) const
 
void addExtraJoint (const ExtraJoint &extraJoint)
 
void clearExtraJoints ()
 
const Mappinginfo () const
 
Mappinginfo ()
 
void resetInfo (Mapping *info)
 
void cloneShapes (SgCloneMap &cloneMap)
 
template<class T >
T * findCache (const std::string &name)
 
template<class T >
const T * findCache (const std::string &name) const
 
template<class T >
T * getOrCreateCache (const std::string &name)
 
bool getCaches (PolymorphicReferencedArrayBase<> &out_caches, std::vector< std::string > &out_names) const
 
void removeCache (const std::string &name)
 
BodyCustomizerHandle customizerHandle () const
 
BodyCustomizerInterfacecustomizerInterface () const
 
bool installCustomizer ()
 
bool installCustomizer (BodyCustomizerInterface *customizerInterface)
 
bool hasVirtualJointForces () const
 
void setVirtualJointForces ()
 
- Public Member Functions inherited from cnoid::Referenced
virtual ~Referenced ()
 
void addRef ()
 
void releaseRef ()
 

Static Public Member Functions

static void addCustomizerDirectory (const std::string &path)
 
static BodyInterfacebodyInterface ()
 

Protected Member Functions

void copy (const Body &org)
 
- Protected Member Functions inherited from cnoid::Referenced
 Referenced ()
 
 Referenced (const Referenced &org)
 
int refCount () const
 

Member Enumeration Documentation

◆ ExtraJointType

Enumerator
EJ_PISTON 
EJ_BALL 

Constructor & Destructor Documentation

◆ Body() [1/2]

Body::Body ( )

◆ Body() [2/2]

Body::Body ( const Body org)

◆ ~Body()

Body::~Body ( )
virtual

Member Function Documentation

◆ addCustomizerDirectory()

void Body::addCustomizerDirectory ( const std::string &  path)
static

◆ addDevice()

void Body::addDevice ( Device device)

◆ addExtraJoint()

void cnoid::Body::addExtraJoint ( const ExtraJoint extraJoint)
inline

◆ bodyInterface()

BodyInterface * Body::bodyInterface ( )
static

◆ calcCenterOfMass()

const Vector3 & Body::calcCenterOfMass ( )

◆ calcForwardKinematics()

void cnoid::Body::calcForwardKinematics ( bool  calcVelocity = false,
bool  calcAcceleration = false 
)
inline

◆ calcTotalMomentum()

void Body::calcTotalMomentum ( Vector3 out_P,
Vector3 out_L 
)

assuming Link::v,w is already computed by calcForwardKinematics(true); assuming Link::wc is already computed by calcCenterOfMass();

◆ centerOfMass()

const Vector3 & Body::centerOfMass ( ) const

◆ clearDevices()

void Body::clearDevices ( )

◆ clearExternalForces()

void Body::clearExternalForces ( )

◆ clearExtraJoints()

void cnoid::Body::clearExtraJoints ( )
inline

◆ clone()

Body * Body::clone ( ) const
virtual

Reimplemented in cnoid::DyBody.

◆ cloneShapes()

void Body::cloneShapes ( SgCloneMap cloneMap)

◆ copy()

void Body::copy ( const Body org)
protected

◆ createLink()

Link * Body::createLink ( const Link org = 0) const
virtual

Reimplemented in cnoid::DyBody.

◆ customizerHandle()

BodyCustomizerHandle Body::customizerHandle ( ) const

◆ customizerInterface()

BodyCustomizerInterface * Body::customizerInterface ( ) const

◆ defaultPosition()

const Position& cnoid::Body::defaultPosition ( ) const
inline

◆ device()

Device* cnoid::Body::device ( int  index) const
inline

◆ devices() [1/2]

const DeviceList& cnoid::Body::devices ( ) const
inline

Example: DeviceList<ForceSensor> forceSensors(body->devices()); or forceSensors << body->devices();

◆ devices() [2/2]

template<class DeviceType >
DeviceList<DeviceType> cnoid::Body::devices ( ) const
inline

◆ extraJoint() [1/2]

ExtraJoint& cnoid::Body::extraJoint ( int  index)
inline

◆ extraJoint() [2/2]

const ExtraJoint& cnoid::Body::extraJoint ( int  index) const
inline

◆ findCache() [1/2]

template<class T >
T* cnoid::Body::findCache ( const std::string &  name)
inline

◆ findCache() [2/2]

template<class T >
const T* cnoid::Body::findCache ( const std::string &  name) const
inline

◆ findDevice() [1/2]

template<class DeviceType >
DeviceType* cnoid::Body::findDevice ( const std::string &  name) const
inline

◆ findDevice() [2/2]

Device* cnoid::Body::findDevice ( const std::string &  name) const
inline

◆ getCaches()

bool Body::getCaches ( PolymorphicReferencedArrayBase<> &  out_caches,
std::vector< std::string > &  out_names 
) const

◆ getOrCreateCache()

template<class T >
T* cnoid::Body::getOrCreateCache ( const std::string &  name)
inline

◆ hasVirtualJointForces()

bool Body::hasVirtualJointForces ( ) const

◆ info() [1/2]

const Mapping * Body::info ( ) const

◆ info() [2/2]

Mapping * Body::info ( )

◆ initializeDeviceStates()

void Body::initializeDeviceStates ( )

◆ initializeState()

void Body::initializeState ( )

◆ installCustomizer() [1/2]

bool Body::installCustomizer ( )

The function installs the pre-loaded customizer corresponding to the model name.

◆ installCustomizer() [2/2]

bool Body::installCustomizer ( BodyCustomizerInterface customizerInterface)

◆ isFixedRootModel()

bool cnoid::Body::isFixedRootModel ( ) const
inline

◆ isStaticModel()

bool cnoid::Body::isStaticModel ( ) const
inline

This function returns true when the whole body is a static, fixed object like a floor.

◆ joint()

Link* cnoid::Body::joint ( int  id) const
inline

This function returns a link that has a given joint ID. If there is no link that has a given joint ID, the function returns a dummy link object whose ID is minus one. If the body has virtual joints, this function returns them by giving the ids over the last one.

◆ link() [1/2]

Link* cnoid::Body::link ( int  index) const
inline

This function returns the link of a given index in the whole link sequence. The order of the sequence corresponds to a link-tree traverse from the root link. The size of the sequence can be obtained by numLinks().

◆ link() [2/2]

Link * Body::link ( const std::string &  name) const

This function returns a link object whose name of Joint node matches a given name. Null is returned when the body has no joint of the given name.

◆ linkTraverse()

const LinkTraverse& cnoid::Body::linkTraverse ( ) const
inline

LinkTraverse object that traverses all the links from the root link

◆ mass()

double Body::mass ( ) const

◆ modelName()

const std::string & Body::modelName ( ) const

◆ name()

const std::string & Body::name ( ) const

◆ numAllJoints()

int cnoid::Body::numAllJoints ( ) const
inline

The number of all the joints including both the actual and virtual joints.

◆ numDevices()

int cnoid::Body::numDevices ( ) const
inline

◆ numExtraJoints()

int cnoid::Body::numExtraJoints ( ) const
inline

◆ numJoints()

int cnoid::Body::numJoints ( ) const
inline

The number of the links that are actual joints. The joints given joint ids are recognized as such joints. Note that the acutal value is the maximum joint ID plus one. Thus there may be a case where the value does not correspond to the actual number of the joints with ids. In other words, the value represents the size of the link sequence obtained by joint() function.

◆ numLinks()

int cnoid::Body::numLinks ( ) const
inline

The number of all the links the body has. The value corresponds to the size of the sequence obtained by link() function.

◆ numVirtualJoints()

int cnoid::Body::numVirtualJoints ( ) const
inline

The number of the joints without joint ids. For example, a joint for simulating a spring is usually handled as such a joint. You can get the joints by giving the index after the last joint id to the joint() function.

◆ removeCache()

void Body::removeCache ( const std::string &  name)

◆ resetDefaultPosition()

void Body::resetDefaultPosition ( const Position T)

◆ resetInfo()

void Body::resetInfo ( Mapping info)

◆ rootLink()

Link* cnoid::Body::rootLink ( ) const
inline

The root link of the body

◆ setModelName()

void Body::setModelName ( const std::string &  name)

◆ setName()

void Body::setName ( const std::string &  name)

◆ setRootLink()

void Body::setRootLink ( Link link)

◆ setVirtualJointForces()

void Body::setVirtualJointForces ( )

◆ updateLinkTree()

void Body::updateLinkTree ( )

This function must be called when the structure of the link tree is changed.


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