Choreonoid  1.5
Classes | Public Member Functions | Protected Attributes | List of all members
cnoid::WorldBase Class Reference

#include <DyWorld.h>

Inheritance diagram for cnoid::WorldBase:
cnoid::World< TConstraintForceSolver > cnoid::World< cnoid::ConstraintForceSolver >

Classes

struct  BodyInfo
 

Public Member Functions

 WorldBase ()
 
virtual ~WorldBase ()
 
int numBodies () const
 get the number of bodies in this world More...
 
DyBodybody (int index) const
 get body by index More...
 
DyBodybody (const std::string &name) const
 get body by name More...
 
ForwardDynamicsPtrforwardDynamics (int index)
 get forward dynamics computation method for body More...
 
int bodyIndex (const std::string &name) const
 get index of body by name More...
 
int addBody (DyBody *body)
 add body to this world More...
 
int addBody (DyBody *body, const ForwardDynamicsPtr &forwardDynamics)
 
void clearBodies ()
 clear bodies in this world More...
 
void clearCollisionPairs ()
 clear collision pairs More...
 
void setTimeStep (double dt)
 set time step More...
 
double timeStep (void) const
 get time step More...
 
void setCurrentTime (double tm)
 set current time More...
 
double currentTime (void) const
 get current time More...
 
void setGravityAcceleration (const Vector3 &g)
 set gravity acceleration More...
 
const Vector3gravityAcceleration () const
 get gravity acceleration More...
 
void enableSensors (bool on)
 enable/disable sensor simulation More...
 
void setOldAccelSensorCalcMode (bool on)
 
void setEulerMethod ()
 choose euler method for integration More...
 
void setRungeKuttaMethod ()
 choose runge-kutta method for integration More...
 
virtual void initialize ()
 initialize this world. This must be called after all bodies are registered. More...
 
void setVirtualJointForces ()
 
virtual void calcNextState ()
 compute forward dynamics and update current state More...
 
std::pair< int, bool > getIndexOfLinkPairs (DyLink *link1, DyLink *link2)
 get index of link pairs More...
 

Protected Attributes

double currentTime_
 
double timeStep_
 
std::vector< BodyInfobodyInfoArray
 
bool sensorsAreEnabled
 
bool isOldAccelSensorCalcMode
 

Constructor & Destructor Documentation

WorldBase::WorldBase ( )
WorldBase::~WorldBase ( )
virtual

Member Function Documentation

int WorldBase::addBody ( DyBody body)

add body to this world

Parameters
body
Returns
index of the body
Note
This must be called before initialize() is called.
int WorldBase::addBody ( DyBody body,
const ForwardDynamicsPtr forwardDynamics 
)

Use this method instead of addBody(const DyBodyPtr& body) when you want to specify a forward dynamics calculater.

DyBody * WorldBase::body ( int  index) const

get body by index

Parameters
indexof the body
Returns
body
DyBody * WorldBase::body ( const std::string &  name) const

get body by name

Parameters
nameof the body
Returns
body
int WorldBase::bodyIndex ( const std::string &  name) const

get index of body by name

Parameters
nameof the body
Returns
index of the body
void WorldBase::calcNextState ( )
virtual

compute forward dynamics and update current state

Reimplemented in cnoid::World< TConstraintForceSolver >, and cnoid::World< cnoid::ConstraintForceSolver >.

void WorldBase::clearBodies ( )

clear bodies in this world

void WorldBase::clearCollisionPairs ( )

clear collision pairs

double cnoid::WorldBase::currentTime ( void  ) const
inline

get current time

Returns
current time[s]
void WorldBase::enableSensors ( bool  on)

enable/disable sensor simulation

Parameters
ontrue to enable, false to disable
Note
This must be called before initialize() is called.
ForwardDynamicsPtr& cnoid::WorldBase::forwardDynamics ( int  index)
inline

get forward dynamics computation method for body

Parameters
indexindex of the body
Returns
forward dynamics computation method
std::pair< int, bool > WorldBase::getIndexOfLinkPairs ( DyLink link1,
DyLink link2 
)

get index of link pairs

Parameters
link1link1
link2link2
Returns
pair of index and flag. The flag is true if the pair was already registered, false othewise.
const Vector3& cnoid::WorldBase::gravityAcceleration ( ) const
inline

get gravity acceleration

Returns
gravity accleration
void WorldBase::initialize ( void  )
virtual

initialize this world. This must be called after all bodies are registered.

Reimplemented in cnoid::World< TConstraintForceSolver >, and cnoid::World< cnoid::ConstraintForceSolver >.

int cnoid::WorldBase::numBodies ( ) const
inline

get the number of bodies in this world

Returns
the number of bodies
void WorldBase::setCurrentTime ( double  tm)

set current time

Parameters
tmcurrent time[s]
void WorldBase::setEulerMethod ( )

choose euler method for integration

void WorldBase::setGravityAcceleration ( const Vector3 g)

set gravity acceleration

Parameters
ggravity acceleration[m/s^2]
void WorldBase::setOldAccelSensorCalcMode ( bool  on)
void WorldBase::setRungeKuttaMethod ( )

choose runge-kutta method for integration

void WorldBase::setTimeStep ( double  dt)

set time step

Parameters
dttime step[s]
void WorldBase::setVirtualJointForces ( )
double cnoid::WorldBase::timeStep ( void  ) const
inline

get time step

Returns
time step[s]

Member Data Documentation

std::vector<BodyInfo> cnoid::WorldBase::bodyInfoArray
protected
double cnoid::WorldBase::currentTime_
protected
bool cnoid::WorldBase::isOldAccelSensorCalcMode
protected
bool cnoid::WorldBase::sensorsAreEnabled
protected
double cnoid::WorldBase::timeStep_
protected

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