|
Choreonoid
1.8
|
#include <SimulatorItem.h>
Public Types | |
| enum | RecordingMode { FullRecording, TailRecording, NoRecording, NumRecordingModes, REC_FULL = FullRecording, REC_TAIL = TailRecording, REC_NONE = NoRecording, N_RECORDING_MODES = NumRecordingModes } |
| enum | TimeRangeMode { UnlimitedTime, SpecifiedTime, TimeBarTime, NumTimeRangeModes, ActiveControlTime, TR_UNLIMITED = UnlimitedTime, TR_ACTIVE_CONTROL = ActiveControlTime, TR_SPECIFIED = SpecifiedTime, TR_TIMEBAR = TimeBarTime, N_TIME_RANGE_MODES = NumTimeRangeModes } |
Public Types inherited from cnoid::Item | |
| enum | Attribute { SubItem, Attached, Temporal, LoadOnly, NumAttributes, SUB_ITEM = SubItem, TEMPORAL = Temporal, LOAD_ONLY = LoadOnly } |
| enum | CheckId { LogicalSumOfAllChecks = -1, PrimaryCheck = 0 } |
| typedef std::function< bool(Item *item)> | ItemPredicate |
Public Member Functions | |
| virtual | ~SimulatorItem () |
| WorldItem * | worldItem () |
| virtual double | worldTimeStep () |
| void | setTimeStep (double step) |
| bool | startSimulation (bool doReset=true) |
| void | stopSimulation (bool isForced=false) |
| void | pauseSimulation () |
| 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()> | sigSimulationPaused () |
| SignalProxy< void()> | sigSimulationResumed () |
| SignalProxy< void(bool isForced)> | sigSimulationFinished () |
| void | setRecordingMode (int selection) |
| int | recordingMode () const |
| void | setTimeRangeMode (int selection) |
| void | setTimeLength (double length) |
| void | setSpecifiedRecordingTimeLength (double length) |
| void | setActiveControlTimeRangeMode (bool on) |
| bool | isActiveControlTimeRangeMode () const |
| void | setRealtimeSyncMode (bool on) |
| void | setDeviceStateOutputEnabled (bool on) |
| bool | isRecordingEnabled () const |
| bool | isDeviceStateOutputEnabled () const |
| bool | isAllLinkPositionOutputMode () |
| virtual void | setAllLinkPositionOutputMode (bool on) |
| const std::string & | controllerOptionString () const |
| const std::vector< SimulationBody * > & | simulationBodies () |
| SimulationBody * | findSimulationBody (BodyItem *bodyItem) |
| SimulationBody * | findSimulationBody (const std::string &name) |
| int | addPreDynamicsFunction (std::function< void()> func) |
| int | addMidDynamicsFunction (std::function< void()> func) |
| int | addPostDynamicsFunction (std::function< void()> func) |
| void | removePreDynamicsFunction (int id) |
| void | removeMidDynamicsFunction (int id) |
| void | removePostDynamicsFunction (int id) |
| CloneMap & | cloneMap () |
| SignalProxy< void(const std::vector< SimulationBodyPtr > &simulationBodies)> | sigSimulationBodyListUpdated () |
| virtual Vector3 | getGravity () const |
| 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 Isometry3 &T) |
| virtual bool | isForcedPositionActiveFor (BodyItem *bodyItem) const |
| virtual void | clearForcedPositions () |
Public Member Functions inherited from cnoid::Item | |
| virtual | ~Item () |
| Item & | operator= (const Item &rhs)=delete |
| int | classId () const |
| Item * | createNewInstance () const |
| void | assign (Item *srcItem) |
| Copy item properties as much as possible like the assignment operator. More... | |
| Item * | duplicate (Item *duplicatedParentItem=nullptr) const |
| Item * | duplicateSubTree () const |
| This function creates a copy of the item including its descendant items. More... | |
| Item * | duplicateAll () const |
| const std::string & | name () const |
| virtual bool | setName (const std::string &name) |
| virtual std::string | displayName () const |
| void | setDisplayNameModifier (std::function< std::string(const Item *item)> modifier) |
| SignalProxy< void(const std::string &oldName)> | sigNameChanged () |
| void | notifyNameChange () |
| void | setAttribute (Attribute attribute) |
| void | unsetAttribute (Attribute attribute) |
| bool | hasAttribute (Attribute attribute) const |
| bool | isSubItem () const |
| void | setSubItemAttributes () |
| bool | isTemporal () const |
| void | setTemporal (bool on=true) |
| bool | isSelected () const |
| void | setSelected (bool on, bool isCurrent=false) |
| void | setSubTreeItemsSelected (bool on) |
| bool | isChecked (int checkId=PrimaryCheck) const |
| void | setChecked (bool on) |
| void | setChecked (int checkId, bool on) |
| int | numCheckStates () const |
| int | numChildren () const |
| int | countDescendantItems () const |
| Item * | childItem () const |
| Item * | prevItem () const |
| Item * | nextItem () const |
| Item * | lastChildItem () const |
| Item * | parentItem () const |
| Item * | headItem () const |
| RootItem * | findRootItem () const |
| bool | isConnectedToRoot () const |
| Item * | localRootItem () const |
| bool | addChildItem (Item *item, bool isManualOperation=false) |
| bool | insertChildItem (Item *item, Item *nextItem, bool isManualOperation=false) |
| bool | insertChild (Item *position, Item *item, bool isManualOperation=false) |
| bool | addSubItem (Item *item) |
| bool | insertSubItem (Item *item, Item *nextItem) |
| void | removeFromParentItem () |
| void | detachFromParentItem () |
| void | clearChildren () |
| template<class ItemType > | |
| ItemType * | find (const std::string &path="") |
| Item * | findItem (const std::string &path) const |
| template<class ItemType > | |
| ItemType * | findItem (const std::string &path) const |
| template<class ItemType > | |
| ItemType * | findItem (std::function< bool(ItemType *item)> pred=nullptr) const |
| Item * | findChildItem (const std::string &path, std::function< bool(Item *item)> pred=nullptr) const |
| template<class ItemType > | |
| ItemType * | findChildItem (const std::string &path, std::function< bool(ItemType *item)> pred=nullptr) const |
| template<class ItemType > | |
| ItemType * | findChildItem (std::function< bool(ItemType *item)> pred=nullptr) const |
| Item * | findSubItem (const std::string &path) const |
| template<class ItemType > | |
| ItemType * | findSubItem (const std::string &path="") const |
| template<class ItemType > | |
| ItemType * | findOwnerItem (bool includeSelf=false) const |
| bool | isOwnedBy (Item *item) const |
| ItemList | childItems (std::function< bool(Item *item)> pred=nullptr) const |
| template<class ItemType > | |
| ItemList< ItemType > | childItems (std::function< bool(ItemType *item)> pred=nullptr) const |
| ItemList | descendantItems (std::function< bool(Item *item)> pred=nullptr) const |
| template<class ItemType > | |
| ItemList< ItemType > | descendantItems (std::function< bool(ItemType *item)> pred=nullptr) const |
| ItemList | selectedDescendantItems (std::function< bool(Item *item)> pred=nullptr) const |
| template<class ItemType > | |
| ItemList< ItemType > | selectedDescendantItems (std::function< bool(Item *item)> pred=nullptr) const |
| bool | traverse (std::function< bool(Item *)> pred) |
| template<class ItemType > | |
| bool | traverse (std::function< bool(ItemType *item)> pred=nullptr) |
| SignalProxy< void()> | sigPositionChanged () |
| SignalProxy< void(Item *topItem, Item *prevTopParentItem)> | sigPositionChanged2 () |
| SignalProxy< void()> | sigSubTreeChanged () |
| SignalProxy< void()> | sigDisconnectedFromRoot () |
| SignalProxy< void()> | sigDetachedFromRoot () |
| SignalProxy< void(bool on)> | sigSelectionChanged () |
| SignalProxy< void(int checkId, bool on)> | sigAnyCheckToggled () |
| SignalProxy< void(bool on)> | sigCheckToggled (int checkId=PrimaryCheck) |
| virtual void | notifyUpdate () |
| SignalProxy< void()> | sigUpdated () |
| bool | setAddon (ItemAddon *addon) |
| void | removeAddon (ItemAddon *addon) |
| template<class AddonType > | |
| AddonType * | findAddon () |
| template<class AddonType > | |
| AddonType * | getAddon () |
| std::vector< ItemAddon * > | addons () |
| bool | load (const std::string &filename, const std::string &format=std::string(), const Mapping *options=nullptr) |
| bool | load (const std::string &filename, Item *parent, const std::string &format=std::string(), const Mapping *options=nullptr) |
| bool | save (const std::string &filename, const std::string &format=std::string(), const Mapping *options=nullptr) |
| bool | overwrite (bool forceOverwrite=false, const std::string &format=std::string()) |
| const std::string & | filePath () const |
| std::string | fileName () const |
| const std::string & | fileFormat () const |
| const Mapping * | fileOptions () const |
| std::time_t | fileModificationTime () const |
| bool | isConsistentWithFile () const |
| void | updateFileInformation (const std::string &filename, const std::string &format, Mapping *options=nullptr) |
| void | setConsistentWithFile (bool isConsistent) |
| void | suggestFileUpdate () |
| void | clearFileInformation () |
| Use this function to disable the implicit overwrite next time. More... | |
| bool | reload () |
| bool | replace (Item *originalItem) |
| Item * | findOriginalItem () const |
| Item * | findReplacementItem () const |
| void | putProperties (PutPropertyFunction &putProperty) |
Public Member Functions inherited from cnoid::Referenced | |
| virtual | ~Referenced () |
Static Public Member Functions | |
| static void | initializeClass (ExtensionManager *ext) |
| static SimulatorItem * | findActiveSimulatorItemFor (Item *item) |
Static Public Member Functions inherited from cnoid::Item | |
| template<class ItemType > | |
| static ItemPredicate | getItemPredicate () |
| template<class ItemType > | |
| static ItemPredicate | getItemPredicate (std::function< bool(ItemType *item)> pred) |
| static Item * | find (const std::string &path) |
Protected Member Functions | |
| SimulatorItem () | |
| SimulatorItem (const std::string &name) | |
| SimulatorItem (const SimulatorItem &org) | |
| virtual void | onPositionChanged () override |
| virtual void | onDisconnectedFromRoot () override |
| virtual void | clearSimulation () |
| virtual SimulationBody * | createSimulationBody (Body *orgBody, CloneMap &cloneMap) |
| virtual SimulationBody * | createSimulationBody (Body *orgBody) |
| CollisionDetector * | getOrCreateCollisionDetector () |
| CollisionDetector * | collisionDetector () |
| virtual bool | initializeSimulation (const std::vector< SimulationBody * > &simBodies)=0 |
| virtual bool | completeInitializationOfSimulation () |
| virtual void | initializeSimulationThread () |
| virtual void | finalizeSimulationThread () |
| virtual bool | stepSimulation (const std::vector< SimulationBody * > &activeSimBodies)=0 |
| virtual void | finalizeSimulation () |
| virtual std::shared_ptr< CollisionLinkPairList > | getCollisions () |
| virtual void | doPutProperties (PutPropertyFunction &putProperty) override |
| virtual bool | store (Archive &archive) override |
| virtual bool | restore (const Archive &archive) override |
Protected Member Functions inherited from cnoid::Item | |
| Item () | |
| Item (const std::string &name) | |
| Item (const Item &item) | |
| virtual void | doAssign (Item *srcItem) |
| Implement the code to copy properties like the assingment operator. More... | |
| virtual Item * | doDuplicate () const |
| Override this function to allow duplication of an instance. More... | |
| virtual Item * | doDuplicate (Item *duplicatedParentItem) const |
| virtual bool | onNewPositionCheck (bool isManualOperation, std::function< void()> &out_callbackWhenAdded) |
| virtual void | onAddedToParent () |
| virtual void | onConnectedToRoot () |
| virtual void | onRemovedFromParent (Item *parentItem, bool isParentBeingDeleted) |
| virtual bool | onChildItemAboutToBeAdded (Item *childItem, bool isManualOperation) |
Protected Member Functions inherited from cnoid::Referenced | |
| Referenced () | |
| Referenced (const Referenced &) | |
| int | refCount () const |
Friends | |
| class | SimulationBody |
| class | SimulatedMotionEngineManager |
|
virtual |
|
protected |
|
protected |
|
protected |
| int SimulatorItem::addMidDynamicsFunction | ( | std::function< void()> | func | ) |
| int SimulatorItem::addPostDynamicsFunction | ( | std::function< void()> | func | ) |
| int SimulatorItem::addPreDynamicsFunction | ( | std::function< void()> | func | ) |
|
virtual |
|
virtual |
Reimplemented in cnoid::AISTSimulatorItem.
|
protectedvirtual |
Reimplemented in cnoid::KinematicSimulatorItem.
|
virtual |
| CloneMap & SimulatorItem::cloneMap | ( | ) |
|
protected |
|
protectedvirtual |
This function is called after all the initializetion processes including those of controllers and sub simulators to complete the initialization of simulation.
Reimplemented in cnoid::AISTSimulatorItem.
| const std::string & SimulatorItem::controllerOptionString | ( | ) | const |
|
protectedvirtual |
|
protectedvirtual |
Reimplemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
| int SimulatorItem::currentFrame | ( | ) | const |
This can only be called from the simulation thread.
| double SimulatorItem::currentTime | ( | ) | const |
This can only be called from the simulation thread.
|
overrideprotectedvirtual |
Override this function to put properties of the item.
Reimplemented from cnoid::Item.
Reimplemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
|
protectedvirtual |
Reimplemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
|
protectedvirtual |
|
static |
| SimulationBody * SimulatorItem::findSimulationBody | ( | BodyItem * | bodyItem | ) |
| SimulationBody * SimulatorItem::findSimulationBody | ( | const std::string & | name | ) |
|
protectedvirtual |
Reimplemented in cnoid::AISTSimulatorItem.
|
virtual |
Reimplemented in cnoid::AISTSimulatorItem.
|
protected |
|
static |
|
protectedpure virtual |
| simBodies | SimulatorBody objects which have a valid body |
Implemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
|
protectedvirtual |
| bool SimulatorItem::isActive | ( | ) | const |
isRunning() && !isPausing()
| bool SimulatorItem::isActiveControlTimeRangeMode | ( | ) | const |
| bool SimulatorItem::isAllLinkPositionOutputMode | ( | ) |
| bool SimulatorItem::isDeviceStateOutputEnabled | ( | ) | const |
|
virtual |
Reimplemented in cnoid::AISTSimulatorItem.
| bool SimulatorItem::isPausing | ( | ) | const |
| bool SimulatorItem::isRecordingEnabled | ( | ) | const |
| bool SimulatorItem::isRunning | ( | ) | const |
|
overrideprotectedvirtual |
Reimplemented from cnoid::Item.
|
overrideprotectedvirtual |
This function is called when the item position in the whole item tree is changed. Note that this function is not called when the item is not connected to the root even if the item is newly attached to another item that is not connected to the root. For such items, the function is called for each item when the sub tree is connected to the root.
Reimplemented from cnoid::Item.
| void SimulatorItem::pauseSimulation | ( | ) |
| int SimulatorItem::recordingMode | ( | ) | const |
| void SimulatorItem::removeMidDynamicsFunction | ( | int | id | ) |
| void SimulatorItem::removePostDynamicsFunction | ( | int | id | ) |
| void SimulatorItem::removePreDynamicsFunction | ( | int | id | ) |
| void SimulatorItem::restartSimulation | ( | ) |
|
overrideprotectedvirtual |
Reimplemented from cnoid::Item.
Reimplemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
| void SimulatorItem::setActiveControlTimeRangeMode | ( | bool | on | ) |
|
virtual |
| 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 | ) |
|
inline |
| void SimulatorItem::setTimeLength | ( | double | length | ) |
| void SimulatorItem::setTimeRangeMode | ( | int | selection | ) |
| void SimulatorItem::setTimeStep | ( | double | step | ) |
|
virtual |
| attachmentPoint | link local position |
| SignalProxy<void(const std::vector<SimulationBodyPtr>& simulationBodies)> cnoid::SimulatorItem::sigSimulationBodyListUpdated | ( | ) |
| SignalProxy< void(bool isForced)> SimulatorItem::sigSimulationFinished | ( | ) |
| SignalProxy< void()> SimulatorItem::sigSimulationPaused | ( | ) |
| SignalProxy< void()> SimulatorItem::sigSimulationResumed | ( | ) |
| 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.
| bool SimulatorItem::startSimulation | ( | bool | doReset = true | ) |
|
protectedpure virtual |
This function is called from the simulation loop thread.
| activeSimBodies | SimulatorBody objects which are non-static ones. |
Implemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
| void SimulatorItem::stopSimulation | ( | bool | isForced = false | ) |
|
overrideprotectedvirtual |
Reimplemented from cnoid::Item.
Reimplemented in cnoid::AISTSimulatorItem, and cnoid::KinematicSimulatorItem.
| WorldItem * SimulatorItem::worldItem | ( | ) |
|
virtual |
|
friend |
|
friend |
1.8.17