Choreonoid
1.5
|
#include <SimulatorItem.h>
Public Types | |
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 } |
![]() | |
enum | Attribute { SUB_ITEM, TEMPORAL, LOAD_ONLY, NUM_ATTRIBUTES } |
Public Member Functions | |
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 () |
virtual void | setAllLinkPositionOutputMode (bool on) |
const std::vector< SimulationBody * > & | simulationBodies () |
SimulationBody * | findSimulationBody (BodyItem *bodyItem) |
SimulationBody * | findSimulationBody (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) |
SgCloneMap & | sgCloneMap () |
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 () |
![]() | |
virtual | ~Item () |
const std::string & | name () const |
virtual void | setName (const std::string &name) |
bool | hasAttribute (Attribute attribute) const |
Item * | childItem () const |
Item * | prevItem () const |
Item * | nextItem () const |
Item * | parentItem () 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) |
RootItem * | findRootItem () const |
Item * | findItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | findItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | find (const std::string &path) |
Item * | findChildItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | findChildItem (const std::string &path) const |
Item * | findSubItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | findSubItem (const std::string &path) const |
Item * | headItem () 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) |
Item * | duplicate () const |
Item * | duplicateAll () 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 () |
Referenced * | customData (int id) |
const Referenced * | customData (int id) const |
void | setCustomData (int id, ReferencedPtr data) |
void | clearCustomData (int id) |
![]() | |
virtual | ~Referenced () |
void | addRef () |
void | releaseRef () |
Static Public Member Functions | |
static void | initializeClass (ExtensionManager *ext) |
static SimulatorItem * | findActiveSimulatorItemFor (Item *item) |
![]() | |
static Item * | find (const std::string &path) |
static SignalProxy< void(const char *type_info_name)> | sigClassUnregistered () |
Protected Member Functions | |
SimulatorItem (const SimulatorItem &org) | |
virtual void | onDisconnectedFromRoot () |
virtual SimulationBody * | createSimulationBody (Body *orgBody)=0 |
CollisionDetectorPtr | collisionDetector () |
virtual bool | initializeSimulation (const std::vector< SimulationBody * > &simBodies)=0 |
virtual void | initializeSimulationThread () |
virtual void | finalizeSimulationThread () |
virtual bool | stepSimulation (const std::vector< SimulationBody * > &activeSimBodies)=0 |
virtual void | finalizeSimulation () |
virtual CollisionLinkPairListPtr | getCollisions () |
void | doPutProperties (PutPropertyFunction &putProperty) |
bool | store (Archive &archive) |
bool | restore (const Archive &archive) |
![]() | |
Item () | |
Item (const Item &item) | |
virtual void | onConnectedToRoot () |
virtual void | onPositionChanged () |
virtual bool | onChildItemAboutToBeAdded (Item *childItem, bool isManualOperation) |
virtual Item * | doDuplicate () const |
virtual void | doAssign (Item *srcItem) |
void | setAttribute (Attribute attribute) |
void | unsetAttribute (Attribute attribute) |
![]() | |
Referenced () | |
Referenced (const Referenced &org) | |
int | refCount () const |
Friends | |
class | SimulatorItemImpl |
class | SimulatedMotionEngineManager |
SimulatorItem::SimulatorItem | ( | ) |
|
virtual |
|
protected |
int SimulatorItem::addMidDynamicsFunction | ( | boost::function< void()> | func | ) |
int SimulatorItem::addPostDynamicsFunction | ( | boost::function< void()> | func | ) |
int SimulatorItem::addPreDynamicsFunction | ( | boost::function< void()> | func | ) |
|
virtual |
|
virtual |
Reimplemented in cnoid::AISTSimulatorItem.
|
virtual |
|
protected |
|
protectedpure virtual |
Implemented in cnoid::AISTSimulatorItem, cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
int SimulatorItem::currentFrame | ( | ) | const |
This can only be called from the simulation thread.
double SimulatorItem::currentTime | ( | void | ) | const |
This can only be called from the simulation thread.
|
protectedvirtual |
Override this function to put properties of the item.
Reimplemented from cnoid::Item.
Reimplemented in cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
|
protectedvirtual |
Reimplemented in cnoid::AISTSimulatorItem, and cnoid::ODESimulatorItem.
|
protectedvirtual |
|
static |
SimulationBody * SimulatorItem::findSimulationBody | ( | BodyItem * | bodyItem | ) |
SimulationBody * SimulatorItem::findSimulationBody | ( | const std::string & | name | ) |
|
inlineprotectedvirtual |
Reimplemented in cnoid::AISTSimulatorItem.
|
static |
|
protectedpure virtual |
simBodies | SimulatorBody objects which have a valid body |
Implemented in cnoid::AISTSimulatorItem, cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
|
protectedvirtual |
Reimplemented in cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
bool SimulatorItem::isActive | ( | ) | const |
isRunning() && !isPausing()
bool SimulatorItem::isAllLinkPositionOutputMode | ( | ) |
bool SimulatorItem::isDeviceStateOutputEnabled | ( | ) | const |
|
virtual |
Reimplemented in cnoid::AISTSimulatorItem.
bool SimulatorItem::isPausing | ( | ) | const |
bool SimulatorItem::isRecordingEnabled | ( | ) | const |
bool SimulatorItem::isRunning | ( | ) | const |
|
protectedvirtual |
Reimplemented from cnoid::Item.
|
virtual |
Selection SimulatorItem::recordingMode | ( | ) | const |
void SimulatorItem::removeMidDynamicsFunction | ( | int | id | ) |
void SimulatorItem::removePostDynamicsFunction | ( | int | id | ) |
void SimulatorItem::removePreDynamicsFunction | ( | int | id | ) |
|
virtual |
|
protectedvirtual |
Reimplemented from cnoid::Item.
Reimplemented in cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
|
virtual |
Reimplemented in cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
void SimulatorItem::setDeviceStateOutputEnabled | ( | bool | on | ) |
|
virtual |
point | link local position to apply the force |
f | linear force to apply in global coordinate |
Reimplemented in cnoid::AISTSimulatorItem.
void SimulatorItem::setRealtimeSyncMode | ( | bool | on | ) |
void SimulatorItem::setRecordingMode | ( | int | selection | ) |
void SimulatorItem::setTimeRangeMode | ( | int | selection | ) |
|
virtual |
attachmentPoint | link local position |
goal | global goal position |
SgCloneMap & SimulatorItem::sgCloneMap | ( | ) |
SignalProxy<void(const std::vector<SimulationBodyPtr>& simulationBodies)> cnoid::SimulatorItem::sigSimulationBodyListUpdated | ( | ) |
SignalProxy< void()> SimulatorItem::sigSimulationFinished | ( | ) |
SignalProxy< void()> SimulatorItem::sigSimulationStarted | ( | ) |
const std::vector< SimulationBody * > & SimulatorItem::simulationBodies | ( | ) |
For sub simulators
int SimulatorItem::simulationFrame | ( | ) | const |
This can be called from non simulation threads.
double SimulatorItem::simulationTime | ( | ) | const |
This can be called from non simulation threads.
|
virtual |
Reimplemented in cnoid::AISTSimulatorItem.
|
protectedpure virtual |
This function is called from the simulation loop thread.
activeSimBodies | SimulatorBody objects which are non-static ones. |
Implemented in cnoid::AISTSimulatorItem, cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
|
virtual |
|
protectedvirtual |
Reimplemented from cnoid::Item.
Reimplemented in cnoid::ODESimulatorItem, and cnoid::BulletSimulatorItem.
|
virtual |
|
friend |
|
friend |