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

#include <ODESimulatorItem.h>

Inheritance diagram for cnoid::ODESimulatorItem:
cnoid::SimulatorItem cnoid::Item cnoid::Referenced

Public Types

enum  StepMode { STEP_ITERATIVE, STEP_BIG_MATRIX, NUM_STEP_MODES }
 
- Public Types inherited from cnoid::SimulatorItem
enum  RecordingMode { REC_FULL, REC_TAIL, REC_NONE, N_RECORDING_MODES }
 
enum  TimeRangeMode {
  TR_UNLIMITED, TR_ACTIVE_CONTROL, TR_SPECIFIED, TR_TIMEBAR,
  N_TIME_RANGE_MODES
}
 
- Public Types inherited from cnoid::Item
enum  Attribute { SUB_ITEM, TEMPORAL, LOAD_ONLY, NUM_ATTRIBUTES }
 

Public Member Functions

 ODESimulatorItem ()
 
 ODESimulatorItem (const ODESimulatorItem &org)
 
virtual ~ODESimulatorItem ()
 
virtual void setAllLinkPositionOutputMode (bool on)
 
void setStepMode (int value)
 
void setGravity (const Vector3 &gravity)
 
void setFriction (double friction)
 
void setJointLimitMode (bool on)
 
void set2Dmode (bool on)
 
void setGlobalERP (double erp)
 
void setGlobalCFM (double value)
 
void setNumIterations (int n)
 
void setOverRelaxation (double value)
 
void setCorrectingVelocityLimitMode (bool on)
 
void setMaxCorrectingVelocity (double vel)
 
void setSurfaceLayerDepth (double value)
 
void useWorldCollisionDetector (bool on)
 
- Public Member Functions inherited from cnoid::SimulatorItem
 SimulatorItem ()
 
virtual ~SimulatorItem ()
 
virtual double worldTimeStep ()
 
virtual bool startSimulation (bool doReset=true)
 
virtual void stopSimulation ()
 
virtual void pauseSimulation ()
 
virtual void restartSimulation ()
 
bool isRunning () const
 
bool isPausing () const
 
bool isActive () const
 isRunning() && !isPausing() More...
 
int currentFrame () const
 This can only be called from the simulation thread. More...
 
double currentTime () const
 This can only be called from the simulation thread. More...
 
int simulationFrame () const
 This can be called from non simulation threads. More...
 
double simulationTime () const
 This can be called from non simulation threads. More...
 
SignalProxy< void()> sigSimulationStarted ()
 
SignalProxy< void()> sigSimulationFinished ()
 
void setRecordingMode (int selection)
 
Selection recordingMode () const
 
void setTimeRangeMode (int selection)
 
void setRealtimeSyncMode (bool on)
 
void setDeviceStateOutputEnabled (bool on)
 
bool isRecordingEnabled () const
 
bool isDeviceStateOutputEnabled () const
 
bool isAllLinkPositionOutputMode ()
 
const std::vector< SimulationBody * > & simulationBodies ()
 
SimulationBodyfindSimulationBody (BodyItem *bodyItem)
 
SimulationBodyfindSimulationBody (const std::string &name)
 
int addPreDynamicsFunction (boost::function< void()> func)
 
int addMidDynamicsFunction (boost::function< void()> func)
 
int addPostDynamicsFunction (boost::function< void()> func)
 
void removePreDynamicsFunction (int id)
 
void removeMidDynamicsFunction (int id)
 
void removePostDynamicsFunction (int id)
 
SgCloneMapsgCloneMap ()
 
SignalProxy< void(const std::vector< SimulationBodyPtr > &simulationBodies)> sigSimulationBodyListUpdated ()
 
virtual void setExternalForce (BodyItem *bodyItem, Link *link, const Vector3 &point, const Vector3 &f, double time=0.0)
 
virtual void clearExternalForces ()
 
virtual void setVirtualElasticString (BodyItem *bodyItem, Link *link, const Vector3 &attachmentPoint, const Vector3 &endPoint)
 
virtual void clearVirtualElasticStrings ()
 
virtual void setForcedPosition (BodyItem *bodyItem, const Position &T)
 
virtual bool isForcedPositionActiveFor (BodyItem *bodyItem) const
 
virtual void clearForcedPositions ()
 
- Public Member Functions inherited from cnoid::Item
virtual ~Item ()
 
const std::string & name () const
 
virtual void setName (const std::string &name)
 
bool hasAttribute (Attribute attribute) const
 
ItemchildItem () const
 
ItemprevItem () const
 
ItemnextItem () const
 
ItemparentItem () const
 
bool addChildItem (Item *item, bool isManualOperation=false)
 
bool addSubItem (Item *item)
 
bool isSubItem () const
 
void detachFromParentItem ()
 
void emitSigDetachedFromRootForSubTree ()
 
bool insertChildItem (Item *item, Item *nextItem, bool isManualOperation=false)
 
bool insertSubItem (Item *item, Item *nextItem)
 
bool isTemporal () const
 
void setTemporal (bool on=true)
 
RootItemfindRootItem () const
 
ItemfindItem (const std::string &path) const
 
template<class ItemType >
ItemType * findItem (const std::string &path) const
 
template<class ItemType >
ItemType * find (const std::string &path)
 
ItemfindChildItem (const std::string &path) const
 
template<class ItemType >
ItemType * findChildItem (const std::string &path) const
 
ItemfindSubItem (const std::string &path) const
 
template<class ItemType >
ItemType * findSubItem (const std::string &path) const
 
ItemheadItem () const
 
template<class ItemType >
ItemType * findOwnerItem (bool includeSelf=false)
 
bool isOwnedBy (Item *item) const
 
bool traverse (boost::function< bool(Item *)> function)
 
template<class ItemType >
bool traverse (boost::function< bool(ItemType *item)> function)
 
Itemduplicate () const
 
ItemduplicateAll () const
 
void assign (Item *srcItem)
 
bool load (const std::string &filename, const std::string &format=std::string())
 
bool load (const std::string &filename, Item *parent, const std::string &format=std::string())
 
bool save (const std::string &filename, const std::string &format=std::string())
 
bool overwrite (bool forceOverwrite=false, const std::string &format=std::string())
 
const std::string & filePath () const
 
const std::string & fileFormat () const
 
std::time_t fileModificationTime () const
 
bool isConsistentWithFile () const
 
void clearFileInformation ()
 
void suggestFileUpdate ()
 
void putProperties (PutPropertyFunction &putProperty)
 
virtual void notifyUpdate ()
 
SignalProxy< void(const std::string &oldName)> sigNameChanged ()
 
SignalProxy< void()> sigUpdated ()
 
SignalProxy< void()> sigPositionChanged ()
 
SignalProxy< void()> sigDetachedFromRoot ()
 
SignalProxy< void()> sigDisconnectedFromRoot ()
 
SignalProxy< void()> sigSubTreeChanged ()
 
ReferencedcustomData (int id)
 
const ReferencedcustomData (int id) const
 
void setCustomData (int id, ReferencedPtr data)
 
void clearCustomData (int id)
 
- Public Member Functions inherited from cnoid::Referenced
virtual ~Referenced ()
 
void addRef ()
 
void releaseRef ()
 

Static Public Member Functions

static void initializeClass (ExtensionManager *ext)
 
- Static Public Member Functions inherited from cnoid::SimulatorItem
static void initializeClass (ExtensionManager *ext)
 
static SimulatorItemfindActiveSimulatorItemFor (Item *item)
 
- Static Public Member Functions inherited from cnoid::Item
static Itemfind (const std::string &path)
 
static SignalProxy< void(const char *type_info_name)> sigClassUnregistered ()
 

Protected Member Functions

virtual SimulationBodycreateSimulationBody (Body *orgBody)
 
virtual bool initializeSimulation (const std::vector< SimulationBody *> &simBodies)
 
virtual void initializeSimulationThread ()
 
virtual bool stepSimulation (const std::vector< SimulationBody *> &activeSimBodies)
 
virtual void finalizeSimulation ()
 
virtual ItemdoDuplicate () const
 
virtual void doPutProperties (PutPropertyFunction &putProperty)
 
virtual bool store (Archive &archive)
 
virtual bool restore (const Archive &archive)
 
- Protected Member Functions inherited from cnoid::SimulatorItem
 SimulatorItem (const SimulatorItem &org)
 
virtual void onDisconnectedFromRoot ()
 
CollisionDetectorPtr collisionDetector ()
 
virtual void finalizeSimulationThread ()
 
virtual CollisionLinkPairListPtr getCollisions ()
 
- Protected Member Functions inherited from cnoid::Item
 Item ()
 
 Item (const Item &item)
 
virtual void onConnectedToRoot ()
 
virtual void onPositionChanged ()
 
virtual bool onChildItemAboutToBeAdded (Item *childItem, bool isManualOperation)
 
virtual void doAssign (Item *srcItem)
 
void setAttribute (Attribute attribute)
 
void unsetAttribute (Attribute attribute)
 
- Protected Member Functions inherited from cnoid::Referenced
 Referenced ()
 
 Referenced (const Referenced &org)
 
int refCount () const
 

Friends

class ODESimulatorItemImpl
 

Member Enumeration Documentation

◆ StepMode

Enumerator
STEP_ITERATIVE 
STEP_BIG_MATRIX 
NUM_STEP_MODES 

Constructor & Destructor Documentation

◆ ODESimulatorItem() [1/2]

ODESimulatorItem::ODESimulatorItem ( )

◆ ODESimulatorItem() [2/2]

ODESimulatorItem::ODESimulatorItem ( const ODESimulatorItem org)

◆ ~ODESimulatorItem()

ODESimulatorItem::~ODESimulatorItem ( )
virtual

Member Function Documentation

◆ createSimulationBody()

SimulationBody * ODESimulatorItem::createSimulationBody ( Body orgBody)
protectedvirtual
Note
orgBody should not owned by the SimulationBody instance. Instead of it, a clone instance which may be a sub Body class should be created and owned.

Implements cnoid::SimulatorItem.

◆ doDuplicate()

Item * ODESimulatorItem::doDuplicate ( ) const
protectedvirtual

Override this function to allow duplication of an instance.

Reimplemented from cnoid::Item.

◆ doPutProperties()

void ODESimulatorItem::doPutProperties ( PutPropertyFunction putProperty)
protectedvirtual

Override this function to put properties of the item.

Note
Please call doPutProperties() of the parent class in this function. For example, when your class directly inherits the Item class, call Item::doPutProperties(putProperty).

Reimplemented from cnoid::SimulatorItem.

◆ finalizeSimulation()

void ODESimulatorItem::finalizeSimulation ( )
protectedvirtual
Note
This function is called from the main thread.

Reimplemented from cnoid::SimulatorItem.

◆ initializeClass()

void ODESimulatorItem::initializeClass ( ExtensionManager ext)
static

◆ initializeSimulation()

bool ODESimulatorItem::initializeSimulation ( const std::vector< SimulationBody *> &  simBodies)
protectedvirtual
Parameters
simBodiesSimulatorBody objects which have a valid body
Note
This function is called from the main thread.

Implements cnoid::SimulatorItem.

◆ initializeSimulationThread()

void ODESimulatorItem::initializeSimulationThread ( )
protectedvirtual

Reimplemented from cnoid::SimulatorItem.

◆ restore()

bool ODESimulatorItem::restore ( const Archive archive)
protectedvirtual

Reimplemented from cnoid::SimulatorItem.

◆ set2Dmode()

void ODESimulatorItem::set2Dmode ( bool  on)

◆ setAllLinkPositionOutputMode()

void ODESimulatorItem::setAllLinkPositionOutputMode ( bool  on)
virtual

Reimplemented from cnoid::SimulatorItem.

◆ setCorrectingVelocityLimitMode()

void ODESimulatorItem::setCorrectingVelocityLimitMode ( bool  on)

◆ setFriction()

void ODESimulatorItem::setFriction ( double  friction)

◆ setGlobalCFM()

void ODESimulatorItem::setGlobalCFM ( double  value)

◆ setGlobalERP()

void ODESimulatorItem::setGlobalERP ( double  erp)

◆ setGravity()

void ODESimulatorItem::setGravity ( const Vector3 gravity)

◆ setJointLimitMode()

void ODESimulatorItem::setJointLimitMode ( bool  on)

◆ setMaxCorrectingVelocity()

void ODESimulatorItem::setMaxCorrectingVelocity ( double  vel)

◆ setNumIterations()

void ODESimulatorItem::setNumIterations ( int  n)

◆ setOverRelaxation()

void ODESimulatorItem::setOverRelaxation ( double  value)

◆ setStepMode()

void ODESimulatorItem::setStepMode ( int  value)

◆ setSurfaceLayerDepth()

void ODESimulatorItem::setSurfaceLayerDepth ( double  value)

◆ stepSimulation()

bool ODESimulatorItem::stepSimulation ( const std::vector< SimulationBody *> &  activeSimBodies)
protectedvirtual

This function is called from the simulation loop thread.

Parameters
activeSimBodiesSimulatorBody objects which are non-static ones.

Implements cnoid::SimulatorItem.

◆ store()

bool ODESimulatorItem::store ( Archive archive)
protectedvirtual

Reimplemented from cnoid::SimulatorItem.

◆ useWorldCollisionDetector()

void ODESimulatorItem::useWorldCollisionDetector ( bool  on)

Friends And Related Function Documentation

◆ ODESimulatorItemImpl

friend class ODESimulatorItemImpl
friend

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