AnimatLab
2
Test
|
Simulates the entire environment. More...
#include <Simulator.h>
Public Member Functions | |
Simulator () | |
Default constructor. More... | |
virtual | ~Simulator () |
Destructor. More... | |
virtual bool | AddBodiesMode () |
Gets the Adds bodies mode. More... | |
virtual void | AddBodiesMode (bool bVal) |
Sets the AddBodies mode. More... | |
virtual void | AddFoodSource (RigidBody *lpFood) |
virtual bool | AddItem (const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false) |
Adds a new object to this parent. More... | |
virtual std::string | AddKeyFrame (std::string strType, long lStart, long lEnd) |
Adds a key frame. More... | |
virtual void | AddNeuralModuleFactory (std::string strModuleName, NeuralModule *lpModule) |
virtual void | AddToExtractExtraData (BodyPart *lpPart) |
virtual void | AddToObjectList (AnimatBase *lpItem) |
Adds an object to the list of all simulation objects. More... | |
virtual float | AlphaThreshold () |
virtual void | AlphaThreshold (float fltValue) |
virtual float | AngularCompliance () |
Gets the angular compliance of the simulation. More... | |
virtual void | AngularCompliance (float fltVal, bool bUseScaling=true) |
Sets the angular compliance of the simulation. More... | |
virtual float | AngularDamping () |
Gets the angular damping of the simulation. More... | |
virtual void | AngularDamping (float fltVal, bool bUseScaling=true) |
Sets the angular damping of the simulation. More... | |
virtual float | AngularKineticLoss () |
Gets the angular kinetic loss of teh simulation. More... | |
virtual void | AngularKineticLoss (float fltVal, bool bUseScaling=true) |
Sets the angular kinetic loss of the simulation. More... | |
virtual void | AttachSourceAdapter (Structure *lpStructure, Adapter *lpAdapter) |
virtual void | AttachTargetAdapter (Structure *lpStructure, Adapter *lpAdapter) |
virtual bool | AutoGenerateRandomSeed () |
Gets whether to automatically generate a random seed. More... | |
virtual void | AutoGenerateRandomSeed (bool bVal) |
Sets whether to automatically generate random seed. More... | |
virtual CStdColor * | BackgroundColor () |
Gets the background color. More... | |
virtual void | BackgroundColor (CStdColor &aryColor) |
Sets the background color. More... | |
virtual void | BackgroundColor (float *aryColor) |
Sets the background color. More... | |
virtual void | BackgroundColor (std::string strXml) |
Loads the background color from an XML data packet. More... | |
virtual void | BlockSimulation () |
Blocks the simulation from stepping. More... | |
virtual void | ConvertV1MeshFile (std::string strOriginalMeshFile, std::string strNewMeshFile, std::string strTexture)=0 |
virtual CStdSerialize * | CreateObject (std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true) |
Creates an object using a class factory. More... | |
virtual float | DenominatorDistanceUnits () |
Gets the denominator distance units. More... | |
virtual int | DesiredFrameRate () |
Gets the frame rate used for the simulation windows in cylces per second. More... | |
virtual void | DesiredFrameRate (int iVal) |
Sets the frame rate in cycles per second. More... | |
virtual float | DesiredFrameStep () |
Gets the frame step time. More... | |
virtual void | DisableCollision (RigidBody *lpBody) |
Disables collision between the past-in body and all rigid bodies of the simulator. More... | |
virtual void | DisableCollisions (Structure *lpStruct, CStdPtrArray< CollisionPair > &m_aryCollisionList) |
virtual void | DisableVideoPlayback () |
Disables the video playback. More... | |
virtual float | DisplayMassUnits () |
Gets the density mass units. More... | |
virtual void | DistanceUnits (std::string strUnits) |
Sets the distance units. More... | |
virtual float | DistanceUnits () |
Gets the distance units used in the simulation. More... | |
virtual void | EnableCollision (RigidBody *lpBody) |
Enables collision between the past-in body and all rigid bodies of the simulator. More... | |
virtual void | EnableCollisions (Structure *lpStruct, CStdPtrArray< CollisionPair > &m_aryCollisionList) |
virtual bool | EnableSimRecording () |
Tells whehter simulation recording is enabled. More... | |
virtual void | EnableSimRecording (bool bVal) |
Sets whether simulation recording is Enabled. More... | |
virtual void | EnableVideoPlayback (std::string strKeyFrameID) |
Enables the video playback. More... | |
virtual float | EndSimTime () |
Gets the time at which to automatically end the simulation. More... | |
virtual void | EndSimTime (float fltVal) |
Sets the time at which to automatically end the simulation. More... | |
virtual long | EndSimTimeSlice () |
Gets the time slice at which to automatically end the simulation. More... | |
virtual void | EndSimTimeSlice (long lVal) |
Sets the time slice at which to automatically end the simulation. More... | |
virtual std::string | ExecutablePath () |
Gets the directory path to the executable. More... | |
virtual void | ExecutablePath (std::string strPath) |
Sets the Executable path. More... | |
virtual AnimatBase * | FindByID (std::string strID, bool bThrowError=true) |
Searches for the object with the specified ID. More... | |
virtual void | FindClosestFoodSources (CStdFPoint &oMouthPos, float fltMinRadius, CStdArray< RigidBody * > &arySources, CStdArray< float > &aryDistances) |
virtual Joint * | FindJoint (std::string strStructureID, std::string strJointID, bool bThrowError=true) |
Finds a joint with the specified ID in the specified structure. More... | |
virtual IStdClassFactory * | FindNeuralModuleFactory (std::string strModuleName, bool bThrowError=false) |
Searches for the first neural module factory with the matching name. More... | |
virtual OdorType * | FindOdorType (std::string strOdorID, bool bThrowError=true) |
Searches for the first odor type with the specified ID. More... | |
virtual Organism * | FindOrganism (std::string strOrganismID, bool bThrowError=true) |
Searches for the first organism with the specified ID. More... | |
virtual RigidBody * | FindRigidBody (std::string strStructureID, std::string strBodyID, bool bThrowError=true) |
Finds a rigid body with the specified ID in the specified structure. More... | |
virtual Structure * | FindStructure (std::string strStructureID, bool bThrowError=true) |
Searches for the first structure with the specified ID. More... | |
virtual Structure * | FindStructureFromAll (std::string strStructureID, bool bThrowError=true) |
Searches for the first structure with the specified ID. More... | |
virtual bool | ForceFastMoving () |
Gets whether we have set the simulation to force fast moving calculations. More... | |
virtual void | ForceFastMoving (bool bVal) |
Set simulation to Force fast moving caculations. More... | |
virtual bool | ForceNoWindows () |
virtual void | ForceNoWindows (bool bVal) |
virtual void | GenerateCollisionMeshFile (std::string strOriginalMeshFile, std::string strCollisionMeshFile, float fltScaleX, float fltScaleY, float fltScaleZ)=0 |
virtual DataChartMgr * | GetDataChartMgr () |
Gets the data chart manager. More... | |
virtual float * | GetDataPointer (const std::string &strDataType) |
Returns a float pointer to a data item of interest in this object. More... | |
virtual ExternalStimuliMgr * | GetExternalStimuliMgr () |
Gets the external stimuli manager. More... | |
virtual LightManager * | GetLightMgr () |
Gets the light manager. More... | |
virtual int | GetMaterialID (std::string strID) |
Gets a material identifier from the physics engine for the specified unique ID. More... | |
virtual Materials * | GetMaterialMgr () |
Gets the material manager. More... | |
virtual void | GetPositionAndRotationFromD3DMatrix (float(&aryTransform)[4][4], CStdFPoint &vPos, CStdFPoint &vRot)=0 |
virtual SimulationRecorder * | GetSimulationRecorder () |
Gets the simulation recorder. More... | |
virtual unsigned long long | GetTimerTick ()=0 |
virtual SimulationWindowMgr * | GetWindowMgr () |
Gets the window manager. More... | |
virtual float | Gravity () |
Gets the gravity value. More... | |
virtual void | Gravity (float fltVal, bool bUseScaling=true) |
Sets the Gravity value. More... | |
virtual void | IncrementPhysicsBodyCount () |
virtual bool | InDrag () |
virtual void | InDrag (bool bVal) |
virtual void | Initialize (int argc, const char **argv)=0 |
Initializes this object. More... | |
virtual void | Initialize () |
Initializes this object with no argc/argv params. More... | |
virtual bool | Initialized () |
Tells if the simulation has been initialized or not. More... | |
virtual void | Initialized (bool bVal) |
Sets whether the simulation has been Initialized. More... | |
virtual bool | InSimulation () |
Used to determine if we are running in a simulation, or in a real control mode. More... | |
virtual float | InverseDistanceUnits () |
Gets the inverse distance units. More... | |
virtual float | InverseMassUnits () |
Gets the inverse mass units. More... | |
virtual bool | IsPhysicsAdapter (Adapter *lpAdapter) |
virtual bool | IsPhysicsBeingUpdated () |
Query if this object is physics being updated on this time slice. More... | |
virtual bool | IsResetting () |
Returns true if the simulation is in the process of resetting. False otherwise. More... | |
virtual float | LinearCompliance () |
Gets the linear compliance of the simulation. More... | |
virtual void | LinearCompliance (float fltVal, bool bUseScaling=true) |
Sets the linear compliance of the simulation. More... | |
virtual float | LinearDamping () |
Gets the linear damping of the simulation. More... | |
virtual void | LinearDamping (float fltVal, bool bUseScaling=true) |
Sets the linear damping of the simulation. More... | |
virtual float | LinearKineticLoss () |
Gets the linear kinetic loss of the simulation. More... | |
virtual void | LinearKineticLoss (float fltVal, bool bUseScaling=true) |
Sets the linear kinetic loss of the simulation. More... | |
virtual void | Load (std::string strFileName="") |
Loads the simulation from an xml configuration file. More... | |
virtual void | Load (CStdXml &oXml) |
Loads the item using an XML data packet. More... | |
virtual void | LoadKeyFrameSnapshot (byte *aryBytes, long &lIndex) |
Loads a key frame snapshot. More... | |
virtual int | ManualRandomSeed () |
Gets the manual random seed value. More... | |
virtual void | ManualRandomSeed (int iSeed) |
Sets the manual random seed value. More... | |
virtual bool | ManualStepSimulation () |
Gets whether the simulation is being stepped manually by the user. More... | |
virtual void | ManualStepSimulation (bool bVal) |
Sets whether the simulation is being stepped manually by the user. More... | |
virtual void | MassUnits (std::string strUnits) |
Sets the mass units. More... | |
virtual float | MassUnits () |
Gets the mass units. More... | |
virtual void | MicroSleep (unsigned int iMicroTime)=0 |
virtual void | MicroWait (unsigned int iMicroTime) |
virtual long | Millisecond () |
Gets the current simulation time in millisecond. More... | |
virtual long | MillisecondToSlice (long lMillisecond) |
Calculates the number of time slices from a supplied number of milliseconds. More... | |
virtual float | MinTimeStep () |
virtual float | MouseSpringDamping () |
Gets the mouse spring damping. More... | |
virtual void | MouseSpringDamping (float fltVal, bool bUseScaling=true) |
Sets the mouse spring damping. More... | |
virtual float | MouseSpringDampingForceMagnitude () |
Gets the magnitude of the mouse spring damping force applied at each time step. More... | |
virtual void | MouseSpringDampingForceMagnitude (float fltVal, bool bUseScaling=true) |
Sets the mouse spring damping force that was used in the current timestep. This is for reporting purposes only. More... | |
virtual float | MouseSpringForceMagnitude () |
Gets the magnitude of the mouse spring force applied at each time step. More... | |
virtual void | MouseSpringForceMagnitude (float fltVal, bool bUseScaling=true) |
Sets the mouse spring force that was used in the current timestep. This is for reporting purposes only. More... | |
virtual float | MouseSpringLengthMagnitude () |
Gets the magnitude of the mouse spring length at each time step. More... | |
virtual void | MouseSpringLengthMagnitude (float fltVal, bool bUseScaling=true) |
Sets the mouse spring length that was used in the current timestep. This is for reporting purposes only. More... | |
virtual float | MouseSpringStiffness () |
Gets the mouse spring stiffness. More... | |
virtual void | MouseSpringStiffness (float fltVal, bool bUseScaling=true) |
Sets the mouse spring stiffness. More... | |
virtual std::string | MoveKeyFrame (std::string strID, long lStart, long lEnd) |
Move key frame. More... | |
virtual void | MoveSimulationToKeyFrame (std::string strKeyFrameID) |
Move simulation to key frame. More... | |
virtual void | NotifyRigidBodyAdded (std::string strID) |
virtual void | NotifyRigidBodyRemoved (std::string strID) |
virtual CStdMap< std::string, AnimatBase * > * | ObjectList () |
Gets the list of pointers to all objects in the simulation. More... | |
virtual bool | Paused () |
Gets whether the Simulation is paused. More... | |
virtual void | Paused (bool bVal) |
Sets the Paused flag. More... | |
virtual bool | PauseSimulation ()=0 |
Pauses the simulation. More... | |
virtual long | PhysicsSliceCount () |
Gets the physics time slice count. More... | |
virtual void | PhysicsSliceCount (long lVal) |
Sets the physics time slice count. More... | |
virtual long | PhysicsStepCount () |
Gets the physics step count. More... | |
virtual short | PhysicsStepInterval () |
Gets the physics step interval. More... | |
virtual void | PhysicsStepInterval (short iVal) |
Sets the physics step interval. More... | |
virtual void | PhysicsSubsteps (int iVal) |
This is used only for the bullet physics engine. It allows the user to specify how many substeps should be made for the physics time step specified. This allows you to keep the overall physics time step you wanted but subdivide it more finely if that is required. However, The larger this number the slower your simulation will run. More... | |
virtual int | PhysicsSubsteps () |
Gets the physics substeps. More... | |
virtual float | PhysicsSubstepTime () |
Gets the physics substep time. More... | |
virtual void | PhysicsTimeStep (float fltVal) |
Sets the integration time step for the physics engine. More... | |
virtual float | PhysicsTimeStep () |
Gets the integration time step for the physics engine. More... | |
virtual int | PlaybackControlMode () |
Gets the playback control mode. More... | |
virtual void | PlaybackControlMode (int iMode) |
Sets the playback control mode. More... | |
virtual float | PresetPlaybackTimeStep () |
Gets the preset playback time step. More... | |
virtual void | PresetPlaybackTimeStep (float fltTimeStep) |
Sets the preset playback time step in milliseconds. More... | |
virtual std::string | ProjectPath () |
Gets the project path. More... | |
virtual void | ProjectPath (std::string strPath) |
Sets the project path. More... | |
virtual void | QueryProperties (CStdPtrArray< TypeProperty > &aryProperties) |
Queries this object for a list of properties that can be changed using SetData. More... | |
virtual float | RealTime () |
Returns the real time since the simulation was started. More... | |
virtual float | RecFieldSelRadius () |
virtual void | RecFieldSelRadius (float fltValue, bool bUseScaling=true, bool bUpdateAllBodies=true) |
virtual void | RemoveFoodSource (RigidBody *lpFood) |
virtual void | RemoveFromExtractExtraData (BodyPart *lpPart) |
virtual void | RemoveFromObjectList (AnimatBase *lpItem) |
Removes an object from the list of all simulation objects. More... | |
virtual bool | RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true) |
Removes a child item from this parent. More... | |
virtual void | RemoveKeyFrame (std::string strID) |
Removes the key frame described by strID. More... | |
virtual void | RemoveSourceAdapter (Structure *lpStructure, Adapter *lpAdapter) |
virtual void | RemoveTargetAdapter (Structure *lpStructure, Adapter *lpAdapter) |
virtual void | Reset () |
Resets all objects of the simulation to their unloaded state. More... | |
virtual void | ResetSimulation () |
Resets the the simulation to its orginal settings at time 0. More... | |
virtual bool | RobotAdpaterSynch () |
Gets whether we need to synch the physics adapters in a simulation to the robot physics time step. More... | |
virtual void | RobotAdpaterSynch (bool bVal) |
Sets whether we need to synch the physics adapters in a simulation to the robot physics time step. More... | |
virtual void | RunSimulation () |
Runs the simulation. More... | |
virtual void | Save (std::string strFilename) |
Saves the simulation file. More... | |
virtual void | SaveKeyFrameSnapshot (byte *aryBytes, long &lIndex) |
Saves a key frame snapshot. More... | |
virtual void | SaveVideo (std::string strPath) |
Saves a video. More... | |
virtual void | Script (ScriptProcessor *lpScript) |
virtual ScriptProcessor * | Script () |
virtual bool | SetData (const std::string &strDataType, const std::string &strValue, bool bThrowError=true) |
Set a variable based on a string data type name. More... | |
virtual bool | SetEndSimTime () |
Gets whether to use the set simulation end time. More... | |
virtual void | SetEndSimTime (bool bVal) |
Sets whether to use the simulation end time. More... | |
virtual void | ShutdownSimulation ()=0 |
Shuts down the simulation. More... | |
virtual bool | ShuttingDown () |
Tells whether the simulation is shutting down or not. More... | |
virtual ISimGUICallback * | SimCallback () |
Calback object from the simulation. More... | |
virtual void | SimCallBack (ISimGUICallback *lpCallback) |
Sets the calback object from the simulation. More... | |
virtual bool | SimRunning () |
Gets whether the simulation is running. More... | |
virtual void | Simulate () |
Simulates the system. More... | |
virtual bool | SimulateHydrodynamics () |
Gets whether the simulation uses hydrodynamics. More... | |
virtual void | SimulateHydrodynamics (bool bVal) |
Sets whether the simulation uses hydrodynamics. More... | |
virtual bool | SimulationBlockConfirm () |
Confirms that the simulation has been blocked. More... | |
virtual std::string | SimulationFile () |
Gets the simulation filename. More... | |
virtual void | SimulationFile (std::string strFile) |
Sets the simulation filename. More... | |
virtual long | SliceToMillisecond (long lSlice) |
Calculates the number of milliseconds from a supplied number of time slices. More... | |
virtual long | SnapshotByteSize () |
Gets the snapshot byte size. More... | |
virtual float | StabilityScale () |
Sets the linear scaling factor that controls the simulation stability parameters. More... | |
virtual void | StabilityScale (float fltVal) |
Sets the linear scaling factor that controls the simulation stability parameters. More... | |
virtual unsigned long long | StartSimTick () |
The time slice tick at which the simulation start. More... | |
virtual bool | StartSimulation ()=0 |
Starts the simulation. More... | |
virtual void | StartVideoPlayback () |
Starts a video playback. More... | |
virtual unsigned long long | StepSimEndTick () |
virtual unsigned long long | StepStartTick () |
virtual void | StepVideoPlayback (int iFrameCount=1) |
Step video playback. More... | |
virtual bool | Stopped () |
Tells if the simulation has been stopped. More... | |
virtual void | StopSimulation ()=0 |
Stops the simulation and resets it. More... | |
virtual void | StopVideoPlayback () |
Stop video playback. More... | |
virtual float | Time () |
Gets the current simulation time in seconds. More... | |
virtual double | TimerDiff_m (unsigned long long lStart, unsigned long long lEnd)=0 |
virtual double | TimerDiff_s (unsigned long long lStart, unsigned long long lEnd)=0 |
virtual double | TimerDiff_u (unsigned long long lStart, unsigned long long lEnd)=0 |
virtual long | TimeSlice () |
Gets the current time slice. More... | |
virtual void | TimeSlice (long lVal) |
Sets the current time slice. More... | |
virtual float | TimeStep () |
Gets the smallest integration time step used within the simulation. More... | |
virtual void | ToggleSimulation ()=0 |
Toggles the simulation between running and paused. More... | |
virtual void | UnblockSimulation () |
Unblock simulation. More... | |
virtual int | VideoLoops () |
Gets the video loops. More... | |
virtual void | VideoLoops (int iVal) |
Sets the video loops. More... | |
virtual KeyFrame * | VideoPlayback () |
Gets the video playback frame. More... | |
virtual void | VideoPlayback (KeyFrame *lpFrame) |
Sets the video playback frame. More... | |
virtual KeyFrame * | VideoRecorder () |
Gets the video recorder. More... | |
virtual void | VideoRecorder (KeyFrame *lpFrame) |
Sets the video recorder. More... | |
virtual long | VideoSliceCount () |
Gets the video slice count. More... | |
virtual void | VideoSliceCount (long lVal) |
Sets the video slice count. More... | |
virtual int | VisualSelectionMode () |
Gets the visual selection mode. More... | |
virtual void | VisualSelectionMode (int iVal) |
Sets the visual selection mode. More... | |
virtual bool | WaitForSimulationBlock (long lTimeout=6000) |
Wait for simulation block. More... | |
virtual void | WriteToConsole (std::string strMessage)=0 |
Public Member Functions inherited from AnimatSim::AnimatBase | |
AnimatBase () | |
Constructs an AnimatBase object. More... | |
virtual | ~AnimatBase () |
Destroys the AnimatBase object.. More... | |
virtual void | AfterResetSimulation () |
Called after a simulation reset for some objects. More... | |
virtual void | Copy (CStdSerialize *lpSource) |
virtual void | Enabled (bool bVal) |
Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications. More... | |
virtual bool | Enabled () |
Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications. More... | |
virtual NeuralModule * | GetNeuralModule () |
Gets the neural module. More... | |
virtual Node * | GetNode () |
Gets the node. More... | |
virtual Simulator * | GetSimulator () |
Gets the simulator pointer. More... | |
virtual Structure * | GetStructure () |
Gets the structure for this node. More... | |
virtual bool | HasProperty (const std::string &strName) |
Queries this object if it has a property with the given name. More... | |
virtual std::string | ID () |
Gets the unique GUID ID of this object. More... | |
virtual void | ID (std::string strValue) |
Sets the unique GUID ID of the object. More... | |
virtual void | Kill (bool bState=true) |
Kills. More... | |
virtual std::string | Name () |
Gets the name of this object. More... | |
virtual void | Name (std::string strValue) |
Sets the name of the object. Blank is acceptable. More... | |
virtual AnimatPropertyType | PropertyType (const std::string &strName) |
virtual void | ReInitialize () |
Re-initialize this object. More... | |
virtual void | RigidBodyAdded (std::string strID) |
virtual void | RigidBodyRemoved (std::string strID) |
virtual bool | Selected () |
Tells if this items is selected or not. More... | |
virtual void | Selected (bool bValue, bool bSelectMultiple) |
Selects this object. More... | |
virtual bool | SetData (const std::string &strDataType, const float fltValue, bool bThrowError=true) |
Set a variable based on a string data type name. More... | |
virtual bool | SetData (const std::string &strDataType, const long lValue, bool bThrowError=true) |
Set a variable based on a string data type name. More... | |
virtual void | SetSystemPointers (Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify) |
Sets the system pointers. More... | |
virtual void | TimeStepModified () |
Notification method that the time step modified has been modified. Objects should recalculate any slice times as needed. More... | |
virtual std::string | Type () |
returns the string type name of this object. More... | |
virtual void | Type (std::string strValue) |
Sets the class type for this object. More... | |
virtual void | VerifySystemPointers () |
Verify that system pointers have been set correctly. More... | |
virtual void | VisualSelectionModeChanged (int iNewMode) |
Visual selection mode changed. More... | |
Static Public Member Functions | |
static Simulator * | CastToDerived (AnimatBase *lpBase) |
static Simulator * | CreateAndInitializeSimulator (std::string strSimFile, bool bForceNoWindows=false) |
Creates a simulator from a specified file and initializes it. More... | |
static Simulator * | CreateSimulator (std::string strAnimatModule, std::string strSimulationFile, bool bForceNoWindows=false) |
Creates a simulator from a simulator file. More... | |
static Simulator * | CreateSimulator (std::string strSimFile, bool bForceNoWindows=false) |
Creates a simulator from a specified file. More... | |
static Simulator * | CreateSimulator (std::string strAnimatModule, CStdXml &oXml) |
Creates a simulator from an xml packet. More... | |
static Simulator * | CreateSimulator (std::string strAnimatModule, std::string strProjectPath, std::string strExecutablePath) |
Creates a simulator from passed in settings.. More... | |
static Simulator * | CreateSimulator (int argc, const char **argv) |
Creates a simulator from the command line. More... | |
static IStdClassFactory * | LoadClassFactory (std::string strModuleName, bool bThrowError=true) |
Loads the class factory specified in the DLL module name. More... | |
Protected Member Functions | |
virtual void | AddOdorType (OdorType *lpOdorType) |
virtual void | AddOdorType (std::string strXml, bool bDoNotInit) |
virtual void | AddOrganism (Organism *lpOrganism) |
Adds a new organism to the list of structures for this simulation. More... | |
virtual void | AddOrganism (std::string strXml) |
Adds an organism defined by an xml data packet. More... | |
virtual void | AddScript (std::string strXml) |
Creates and adds a scripting object to this structure. More... | |
virtual void | AddStructure (Structure *lpStructure) |
Adds a new "static" structure to the list of structures for this simulation. More... | |
virtual void | AddStructure (std::string strXml) |
Adds an structure defined by an xml data packet. More... | |
virtual void | AfterStepSimulation () |
Method called for the base Simulator object to run code after the physics engine has been fully stepped. This is primarily being used to collect extra data if needed after the physics engine has been run. If you are building your own physics engine you will need to remember to call this after you have stepped it. More... | |
virtual double | CalculateRemainingPlaybackTime () |
virtual long | CalculateSnapshotByteSize () |
Calculates the snapshot byte size. More... | |
virtual void | CheckEndSimulationTime () |
Checks the simulation end time. More... | |
virtual bool | CheckSimulationBlock () |
Checks whether or not a simulation block has been requested. More... | |
float | ConvertDenominatorDistanceUnits (std::string strUnits) |
Convert the string ID of the distance units to a conversion factor for the denominator of the distance units. More... | |
float | ConvertDisplayMassUnits (std::string strUnits) |
Convert the string ID of the display units to a conversion factor. More... | |
float | ConvertDistanceUnits (std::string strUnits) |
Convert the string ID of the distance units to a conversion factor. More... | |
float | ConvertMassUnits (std::string strUnits) |
Convert the string ID of the mass units to a conversion factor. More... | |
virtual SimulationRecorder * | CreateSimulationRecorder ()=0 |
Creates the simulation recorder. More... | |
virtual double | CurrentRealTimeForStep_n () |
virtual double | CurrentRealTimeForStep_s () |
virtual int | FindAdapterListIndex (CStdArray< Adapter * > aryAdapters, std::string strID, bool bThrowError=true) |
virtual int | FindExtraDataIndex (BodyPart *lpPart) |
virtual int | FindFoodSourceIndex (RigidBody *lpFood) |
Searches for the index of the food source. More... | |
virtual void | GenerateAutoSeed () |
Generates an automatic seed value based on the current time. More... | |
virtual void | HandleCriticalError (std::string strError) |
virtual void | HandleNonCriticalError (std::string strError) |
virtual void | InitializeRandomNumbers () |
Initializes the random number generation system. More... | |
virtual void | InitializeStructures () |
Initializes all of the structures of this simulation. More... | |
virtual void | LoadEnvironment (CStdXml &oXml) |
Loads all structures from from the configuration file for this simulation. More... | |
OdorType * | LoadOdorType (CStdXml &oXml) |
Loads an odor type. More... | |
Organism * | LoadOrganism (CStdXml &oXml) |
Loads an organism. More... | |
virtual ScriptProcessor * | LoadScript (CStdXml &oXml) |
Loads the script. More... | |
Structure * | LoadStructure (CStdXml &oXml) |
Loads a structure. More... | |
virtual void | NotifyTimeStepModified () |
Notifies the objects that time step has been modified. More... | |
virtual void | ProcessSimulationStep () |
Process the an entire step of the simulation. This includes the simulation portion, video and calculating timing. More... | |
virtual void | RecordAddedPlaybackTime () |
virtual void | RecordSimulationStepTimer () |
virtual void | RecordSimulationTotalStepTimer () |
virtual void | RecordVideoFrame () |
Record video frame. More... | |
virtual double | RemainingVideoFrameTime () |
virtual void | RemoveOdorType (std::string strID, bool bThrowError=true) |
virtual void | RemoveOrganism (std::string strID, bool bThrowError=true) |
Removes an organism by its ID. More... | |
virtual void | RemoveScript (std::string strID, bool bThrowError=true) |
Removes the script based on ID. More... | |
virtual void | RemoveStructure (std::string strID, bool bThrowError=true) |
Removes a structure by its ID. More... | |
virtual void | ResetSimulationTimingParams () |
Resets the variables that are used to keep track of the time that each component of the time step takes to execute. More... | |
virtual void | SimPausing () |
Simulation pausing event. More... | |
virtual void | SimStarting () |
Simulation starting event. More... | |
virtual void | SimStopping () |
Simulation stopping event. More... | |
virtual void | SimulateBegin () |
Called at the beginning of the Simulate method. More... | |
virtual void | SimulateEnd () |
Called at the end of the Simulate method. More... | |
virtual void | SnapshotStopFrame ()=0 |
Takes a snapshot of the current frame. More... | |
virtual void | StartSimulationStepTimer () |
virtual void | StartVideoFrameTimer () |
virtual void | Step () |
Steps the simulation forward by one time slice. More... | |
virtual void | StepDataCharts () |
virtual void | StepExternalStimuli () |
virtual void | StepNeuralEngine () |
Step the neural engine of each organism. More... | |
virtual void | StepPhysicsEngine () |
Calls StepPhysicsEngine of all structures. More... | |
virtual void | StepPlaybackControl () |
virtual void | StepSimRecorder () |
virtual void | StepSimulation () |
Steps the entire simulation forward by one physics integration time step. More... | |
virtual void | StepVideoFrame () |
virtual double | TimeBetweenVideoFrames () |
virtual void | UpdateSimulationWindows ()=0 |
Static Protected Member Functions | |
static void | LoadAnimatModuleName (std::string strFile, std::string &strAnimatModule) |
Loads an animat module name. More... | |
static void | LoadAnimatModuleName (CStdXml &oXml, std::string &strAnimatModule) |
Loads an animat module name. More... | |
Protected Attributes | |
CStdMap< std::string, Structure * > | m_aryAllStructures |
CStdArray< BodyPart * > | m_aryExtraDataParts |
CStdArray< RigidBody * > | m_aryFoodSources |
An Array of RigidBody parts that also act as food sources within the environment. | |
CStdMap< std::string, IStdClassFactory * > | m_aryNeuralModuleFactories |
CStdMap< std::string, AnimatBase * > | m_aryObjectList |
A list of all animatbase objects in the simulation. | |
CStdPtrMap< std::string, OdorType > | m_aryOdorTypes |
CStdPtrMap< std::string, Organism > | m_aryOrganisms |
CStdArray< Adapter * > | m_arySourcePhysicsAdapters |
Array of source physics adapters. | |
CStdPtrMap< std::string, Structure > | m_aryStructures |
CStdArray< Adapter * > | m_aryTargetPhysicsAdapters |
Array of target physics adapters. | |
bool | m_bAddBodiesMode |
true if the AddBodies mode is enabled within the GUI. | |
bool | m_bAutoGenerateRandomSeed |
bool | m_bBlockSimulation |
true to block simulation. See WaitForBlock for more info. | |
bool | m_bEnableSimRecording |
true to enable simulation recording | |
bool | m_bForceFastMoving |
true if we need to set the physics system to force handling of fast moving objects. | |
bool | m_bForceNoWindows |
If this is set to true then no graphical simulation windows will be created regardless of what the config files says. | |
bool | m_bForceSimulationStop |
Set to true to stop the simulation. This is a more forceful way of stopping the sim. | |
bool | m_bInDrag |
Tells if we are in the middle of a mouse drag operation to move or rotate a part. | |
bool | m_bInitialized |
true if the simulation has been initialized. | |
bool | m_bIsResetting |
True if we are in the process of resetting the simulation. False otherwise. | |
bool | m_bManualStepSimulation |
If true then the user is manually stepping the simulation. | |
bool | m_bPaused |
true if the simulation is paused. | |
bool | m_bRecordVideo |
true to record video | |
bool | m_bRobotAdpaterSynch |
bool | m_bSetEndSim |
true if we the user has manually set the simulation end time. | |
bool | m_bShuttingDown |
True if the simulation is shutting down. This is used by other objects in their destructor to know whether to do certain operations or not. | |
bool | m_bSimBlockConfirm |
true to confirm that a simulation block is in place. | |
bool | m_bSimRunning |
true if the simulation is running | |
bool | m_bSimulateHydrodynamics |
bool | m_bSteppingSim |
true if stepping of simulation has begun. This is set to true once the Simulate methods has been called. | |
bool | m_bStopSimulation |
Set to true to stop the simulation. | |
double | m_dblTime |
double | m_dblTimeStep |
double | m_dblTotalStepTime |
This is a temp variable for measuring sim time for a set period for each simulation. | |
float | m_fltActualFrameRate |
The frame rate for the current frame. | |
float | m_fltAlphaThreshold |
The threshold value to use when setting the AlphaFunc for the entire scene. | |
float | m_fltAngularCompliance |
The angular compliance of the simulation environment. | |
float | m_fltAngularDamping |
The angular damping of the simulation environment. | |
float | m_fltAngularKineticLoss |
The angular kinetic loss of the simulation environment. | |
float | m_fltDataChartStepTime |
time to process data charts for this step. | |
float | m_fltDenominatorDistanceUnits |
float | m_fltDesiredFrameStep |
The desired time value duration of the video frame step. | |
float | m_fltDisplayMassUnits |
Tells how many kilograms/m^3 each unit of density is worth within the simulation environment. | |
float | m_fltDistanceUnits |
Tells how many meters each unit of distance is worth within the simulation environment. | |
float | m_fltEndSimTime |
The time when the simulation should end. | |
float | m_fltExternalStimuliStepTime |
Time to process external stimuli for this step. | |
float | m_fltGravity |
The acceleration of gravity to use in the simulation. | |
float | m_fltInverseDistanceUnits |
The inverse of the distance units. | |
float | m_fltInverseMassUnits |
The inverse of the mass units. | |
float | m_fltLinearCompliance |
The linear compliance of the simulation environment. | |
float | m_fltLinearDamping |
The linear damping of the simulation environment. | |
float | m_fltLinearKineticLoss |
The linear kinetic loss of the simulation environment. | |
float | m_fltMassUnits |
Tells how many kilograms each unit of mass is worth within the simulation environment. | |
float | m_fltMouseSpringDampingForceMagnitude |
The magnitude of the damping component of the force being applied by the mosue spring at each step. | |
float | m_fltMouseSpringForceMagnitude |
The magnitude of the force being applied by the mosue spring at each step. | |
float | m_fltMouseSpringLengthMagnitude |
The magnitude of the length of the mouse spring at each step. | |
float | m_fltMouseSpringStiffness |
The stiffness of the user mouse spring. | |
float | m_fltPhysicsStepTime |
This is the time pers step for the physics engine. | |
float | m_fltPhysicsSubstepTime |
float | m_fltPhysicsTimeStep |
The time increment for each time slice of the physics simulation. | |
float | m_fltPlaybackAdditionRealTimeToStep |
float | m_fltPresetPlaybackTimeStep |
float | m_fltPrevPhysicsStepTime |
float | m_fltPrevTotalRealTimeForStep |
Previous total time for the step. Used for exponential smoothing algorithm. | |
float | m_fltRealTime |
This keeps track of the real time from the begginning of the simulation. | |
float | m_fltRecFieldSelRadius |
float | m_fltRemainingStepTime |
float | m_fltSimRecorderStepTime |
Time to process simulation recorder for this step. | |
float | m_fltSimulationRealTimeToStep |
float | m_fltStabilityScale |
A linear scaling factor for setting the simulation parameters. | |
float | m_fltTime |
The current simulation time. | |
float | m_fltTimeStep |
This is the minimum integration time step taken for all neural modules and the physics engine. | |
float | m_fltTotalMicroSleepCount |
Total number of times we called microsleep during playback pause calculations. | |
float | m_fltTotalMicroSleepTime |
Total time we were in microsleep during playback pause calculations;. | |
float | m_fltTotalMicroWaitCount |
Total number of loop iterations for microwait during playback pause calculations. | |
float | m_fltTotalMicroWaitTime |
Total time we were in microwait during playback pause calculations;. | |
float | m_fltTotalNeuralStepTime |
Total time for processing of all neural items for this step. | |
float | m_fltTotalRealTimeForStep |
This is the total time it takes to complete one physics time step. | |
float | m_fltTotalRealTimeForStepSmooth |
Current value of the exponential smoothing algorith for real time step. | |
float | m_fltVideoEndTime |
Time of the video end. | |
float | m_fltVideoPlaybackFrameTime |
Time of the video playback frame. | |
float | m_fltVideoRecordFrameTime |
Time of the video record frame. | |
float | m_fltVideoStartTime |
Time of the video start. | |
float | m_ftlMouseSpringDamping |
The damping of the user mouse spring. | |
int | m_iDesiredFrameRate |
Desired frame rate of the simulation video. | |
int | m_iExtraDataCount |
Number of parts that require extra data to be collected. | |
int | m_iManualRandomSeed |
int | m_iPhysicsBodyCount |
int | m_iPhysicsStepCount |
short | m_iPhysicsStepInterval |
int | m_iPhysicsSubsteps |
int | m_iPlaybackControlMode |
Determines the mode used for playback control. See the accessor method for more details. | |
int | m_iSelectionMode |
This is the currect visual selection mode used within the GUI. | |
int | m_iTargetAdapterCount |
Number of target adapters. | |
int | m_iVideoLoops |
Zero-based index of the video loops. | |
int | m_iVideoStep |
Zero-based index of the video step. | |
int | m_iVideoStepSize |
Size of the i video step. | |
float | m_lEndSimTimeSlice |
The time slice when the simulation should end. | |
unsigned long long | m_lLastTickTaken |
This is the last tick taken by a GetTickCount. It is used in debugging. | |
IStdClassFactory * | m_lpAnimatClassFactory |
long | m_lPhysicsSliceCount |
The number of slices that the physics engine has been updated. | |
ThreadProcessor * | m_lpIOThread |
The pointer to an i/o thread processor. | |
ThreadProcessor * | m_lpNeuralThread |
The pointer to a neural thread processor. | |
ThreadProcessor * | m_lpPhysicsThread |
The pointer to the physics thread processor. | |
ScriptProcessor * | m_lpScript |
Organism * | m_lpSelOrganism |
The pointer to a selected organism. | |
Structure * | m_lpSelStructure |
The pointer to a selected structure. | |
ISimGUICallback * | m_lpSimCallback |
SimulationRecorder * | m_lpSimRecorder |
The pointer to a simulation recorder. | |
KeyFrame * | m_lpSimStopPoint |
The pointer to a simulation stop point. | |
KeyFrame * | m_lpVideoPlayback |
The pointer to a video playback. | |
KeyFrame * | m_lpVideoRecorder |
The pointer to a video recorder. | |
SimulationWindowMgr * | m_lpWinMgr |
Manager for SimulationWindows. | |
long | m_lSnapshotByteSize |
Size of a memory snapshot in bytes. | |
unsigned long long | m_lStartSimTick |
The tick count for when the simulation first begins running. | |
unsigned long long | m_lStepSimEndTick |
The tick count for when the simulation procressing of the step ends. | |
unsigned long long | m_lStepStartTick |
This is the tick count that is taken when a step is started. | |
long | m_lStepTimeCount |
This is a temp variable for measuring sim time for a set period for each simulation. | |
long | m_lTimeSlice |
The current time slice. This a long value. | |
long | m_lVideoEndSlice |
The video end slice. | |
long | m_lVideoFrame |
The video frame. | |
unsigned long long | m_lVideoFrameStartTick |
The tick when a new video frame time starts. | |
long | m_lVideoSliceCount |
Current video slice time slice. | |
long | m_lVideoStartSlice |
The video start slice. | |
DataChartMgr | m_oDataChartMgr |
Manager for data charts. | |
ExternalStimuliMgr | m_oExternalStimuliMgr |
Manager for external stimuli. | |
LightManager | m_oLightMgr |
Manager for the light objects. | |
Materials | m_oMaterialMgr |
Manager for Materials. | |
CStdMap< std::string, Organism * >::iterator | m_oOrganismIterator |
An organism iterator. | |
CStdMap< std::string, Structure * >::iterator | m_oStructureIterator |
A structure iterator. | |
std::string | m_strExecutablePath |
The directory path where the executable is located. | |
std::string | m_strProjectPath |
The directory path where the simulation configuration files are located. | |
std::string | m_strSimulationFile |
The name of the Animat Simulation (ASIM) file. | |
std::string | m_strVideoFilename |
Filename of the video file. | |
CStdColor | m_vBackgroundColor |
The background color to use when drawing the environment. | |
Protected Attributes inherited from AnimatSim::AnimatBase | |
bool | m_bEnabled |
Tells if this item is enabled or not. If it is not enabled then it is not run. | |
bool | m_bSelected |
Tells whether the object is selected or not. | |
AnimatSim::Behavior::NeuralModule * | m_lpModule |
The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NULL. | |
Node * | m_lpNode |
The pointer to this items parent Node. If this is not relevant for this object then this is NULL. | |
Simulator * | m_lpSim |
The pointer to a Simulation. | |
AnimatSim::Environment::Structure * | m_lpStructure |
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL. | |
std::string | m_strID |
The unique Id for this object. | |
std::string | m_strName |
The name for this object. | |
std::string | m_strType |
The type for this object. Examples are Box, Plane, Neuron, etc.. | |
Simulates the entire environment.
This is the core simulation object of AnimatLab. It is responsible for managing all organisms/structures, the environment, etc.. Essentially, anything related to the simulation is controlled by this class, or the derived class that is specific for a physics engine.
Definition at line 31 of file Simulator.h.
AnimatSim::Simulator::Simulator | ( | ) |
Default constructor.
Definition at line 60 of file Simulator.cpp.
References m_bAddBodiesMode, m_bAutoGenerateRandomSeed, m_bBlockSimulation, m_bEnableSimRecording, m_bForceFastMoving, m_bForceNoWindows, m_bForceSimulationStop, m_bInDrag, m_bInitialized, m_bIsResetting, m_bManualStepSimulation, m_bPaused, m_bRecordVideo, m_bRobotAdpaterSynch, m_bShuttingDown, m_bSimBlockConfirm, m_bSimRunning, m_bSimulateHydrodynamics, m_bSteppingSim, m_bStopSimulation, m_dblTotalStepTime, m_fltActualFrameRate, m_fltAlphaThreshold, m_fltAngularCompliance, m_fltAngularDamping, m_fltAngularKineticLoss, m_fltDataChartStepTime, m_fltDenominatorDistanceUnits, m_fltDesiredFrameStep, m_fltDisplayMassUnits, m_fltDistanceUnits, m_fltEndSimTime, m_fltExternalStimuliStepTime, m_fltGravity, m_fltInverseDistanceUnits, m_fltInverseMassUnits, m_fltLinearCompliance, m_fltLinearDamping, m_fltLinearKineticLoss, m_fltMassUnits, m_fltMouseSpringDampingForceMagnitude, m_fltMouseSpringForceMagnitude, m_fltMouseSpringLengthMagnitude, m_fltMouseSpringStiffness, m_fltPhysicsStepTime, m_fltPhysicsSubstepTime, m_fltPhysicsTimeStep, m_fltPlaybackAdditionRealTimeToStep, m_fltPresetPlaybackTimeStep, m_fltPrevPhysicsStepTime, m_fltPrevTotalRealTimeForStep, m_fltRealTime, m_fltRecFieldSelRadius, m_fltRemainingStepTime, m_fltSimRecorderStepTime, m_fltSimulationRealTimeToStep, m_fltStabilityScale, m_fltTime, m_fltTimeStep, m_fltTotalMicroSleepCount, m_fltTotalMicroSleepTime, m_fltTotalMicroWaitCount, m_fltTotalMicroWaitTime, m_fltTotalNeuralStepTime, m_fltTotalRealTimeForStep, m_fltTotalRealTimeForStepSmooth, m_fltVideoEndTime, m_fltVideoPlaybackFrameTime, m_fltVideoRecordFrameTime, m_fltVideoStartTime, m_ftlMouseSpringDamping, m_iDesiredFrameRate, m_iManualRandomSeed, m_iPhysicsBodyCount, m_iPhysicsStepCount, m_iPhysicsStepInterval, m_iPhysicsSubsteps, m_iPlaybackControlMode, m_iSelectionMode, m_iVideoLoops, m_iVideoStepSize, m_lEndSimTimeSlice, m_lpAnimatClassFactory, m_lPhysicsSliceCount, m_lpIOThread, m_lpNeuralThread, m_lpPhysicsThread, m_lpSelOrganism, m_lpSelStructure, m_lpSimCallback, m_lpSimRecorder, m_lpSimStopPoint, m_lpVideoPlayback, m_lpVideoRecorder, m_lpWinMgr, m_lSnapshotByteSize, m_lStepTimeCount, m_lTimeSlice, m_lVideoEndSlice, m_lVideoFrame, m_lVideoSliceCount, m_lVideoStartSlice, m_oDataChartMgr, m_oExternalStimuliMgr, m_oLightMgr, m_oMaterialMgr, AnimatSim::AnimatBase::m_strID, AnimatSim::AnimatBase::m_strName, m_strVideoFilename, m_vBackgroundColor, StdUtils::CStdColor::Set(), and AnimatSim::AnimatBase::SetSystemPointers().
|
virtual |
Destructor.
Definition at line 197 of file Simulator.cpp.
References AnimatSim::SimulationWindowMgr::Close(), m_aryAllStructures, m_aryExtraDataParts, m_aryFoodSources, m_aryNeuralModuleFactories, m_aryOdorTypes, m_aryOrganisms, m_arySourcePhysicsAdapters, m_aryStructures, m_aryTargetPhysicsAdapters, m_bShuttingDown, m_bSteppingSim, m_iExtraDataCount, m_iTargetAdapterCount, m_lpAnimatClassFactory, m_lpSimCallback, m_lpSimRecorder, m_lpSimStopPoint, m_lpWinMgr, and StdUtils::Std_TraceMsg().
|
virtual |
Gets the Adds bodies mode.
Definition at line 499 of file Simulator.cpp.
References m_bAddBodiesMode.
Referenced by SetData().
|
virtual |
Sets the AddBodies mode.
Within the GUI the user can select the AddBodies mode. When they click on another part it will add a new part at that location. The simulation needs to know if it is in that mode in order to behave in the correct manner. This flag lets it know the state of that mode.
bVal | new value. |
Definition at line 513 of file Simulator.cpp.
References m_bAddBodiesMode.
|
virtual |
Adds a new object to this parent.
Generic method to add a new child item to this parent by specifying a string item type descriptor and an xml packet that can be used to load in the new object. The GUI uses this method to create new items that were added with the user interface. The item type lets the method determine what type of item is being created, like synapse, neuron, body part, etc.. It then gets the modulename, classname, and type from the xml and calls CreateObject to create the appropriate type of object. Then it passes in the xml packet to the new objects load method and does any needed initialization and adds it to the parent.
strItemType | String descriptor of the type of item that is being created. |
strXml | XML packet that is used to create and load the new item. |
bThrowError | If true then throw an error if there is a problem, otherwise return false. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 4870 of file Simulator.cpp.
References AnimatSim::Charting::DataChartMgr::AddDataChart(), AnimatSim::Environment::Materials::AddItem(), AnimatSim::Environment::LightManager::AddItem(), AnimatSim::AnimatBase::AddItem(), AddOrganism(), AddScript(), AnimatSim::ExternalStimuli::ExternalStimuliMgr::AddStimulus(), AddStructure(), m_lpWinMgr, m_oDataChartMgr, m_oExternalStimuliMgr, m_oLightMgr, m_oMaterialMgr, and StdUtils::Std_CheckString().
|
virtual |
Adds a key frame.
strType | Type of the string. |
lStart | The start time slice. |
lEnd | The end time slice. |
Definition at line 5073 of file Simulator.cpp.
References AnimatSim::Recording::SimulationRecorder::Add(), AnimatSim::AnimatBase::ID(), and m_lpSimRecorder.
|
protectedvirtual |
Adds a new organism to the list of structures for this simulation.
This method gets a list of all organisms and a list of referneces to all structures in this simulation that are mapped to their ID value. This allows us to use the STL find funtions to find organisms. This is more efficeient that using a loop and recursion. This also allows us to ensure that each organism/structure that is being added has a unique ID value. If you attempt to add a organism that has a ID that is already in the list then an exception will be thrown. Note that this method is NOT creating the object itself, that is done elsewhere. It is simply adding it to the organism list and adding a reference to that created object to m_aryAllStructures list.
[in,out] | lpOrganism | Pointer to an organism. |
Referenced by AddItem(), and LoadOrganism().
|
protectedvirtual |
Adds an organism defined by an xml data packet.
This is primarily used by the GUI to create a new organism within the simulation.
strXml | The xml packet to load. |
Definition at line 4382 of file Simulator.cpp.
References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), and LoadOrganism().
|
protectedvirtual |
Creates and adds a scripting object to this structure.
This method is primarily used by the GUI to add a new script objects to the structure. It creates the ScriptProcessor from info in the XML packet and then uses the XML to load in the new script.
strXml | The xml configuration data packet. |
Definition at line 4524 of file Simulator.cpp.
References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), AnimatSim::AnimatBase::Initialize(), and LoadScript().
Referenced by AddItem().
|
protectedvirtual |
Adds a new "static" structure to the list of structures for this simulation.
[in,out] | lpStructure | Pointer to the structure to add. |
Referenced by AddItem(), and LoadStructure().
|
protectedvirtual |
Adds an structure defined by an xml data packet.
This is primarily used by the GUI to create a new organism within the simulation.
strXml | The xml packet to load. |
Definition at line 4437 of file Simulator.cpp.
References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), and LoadStructure().
|
virtual |
Adds an object to the list of all simulation objects.
[in,out] | lpItem | Pointer to the item to add. |
Definition at line 4068 of file Simulator.cpp.
References FindByID(), AnimatSim::AnimatBase::ID(), and m_aryObjectList.
Referenced by AnimatSim::AnimatBase::Load(), Load(), FiringRateSim::FiringRateModule::LoadNetworkXml(), and AnimatCarlSim::CsNeuralModule::LoadNetworkXml().
|
protectedvirtual |
Method called for the base Simulator object to run code after the physics engine has been fully stepped. This is primarily being used to collect extra data if needed after the physics engine has been run. If you are building your own physics engine you will need to remember to call this after you have stepped it.
Definition at line 2478 of file Simulator.cpp.
References m_aryExtraDataParts, and m_iExtraDataCount.
Referenced by VortexAnimatSim::VsSimulator::StepSimulation().
|
virtual |
Gets the angular compliance of the simulation.
Definition at line 805 of file Simulator.cpp.
References m_fltAngularCompliance.
Referenced by SetData().
|
virtual |
Sets the angular compliance of the simulation.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 816 of file Simulator.cpp.
References m_fltAngularCompliance, m_fltDistanceUnits, m_fltMassUnits, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the angular damping of the simulation.
Definition at line 863 of file Simulator.cpp.
References m_fltAngularDamping.
Referenced by SetData().
|
virtual |
Sets the angular damping of the simulation.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 874 of file Simulator.cpp.
References DisplayMassUnits(), m_fltAngularDamping, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the angular kinetic loss of teh simulation.
Definition at line 920 of file Simulator.cpp.
References m_fltAngularKineticLoss.
Referenced by SetData().
|
virtual |
Sets the angular kinetic loss of the simulation.
fltVal | The new value. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 930 of file Simulator.cpp.
References DisplayMassUnits(), m_fltAngularKineticLoss, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets whether to automatically generate a random seed.
Definition at line 715 of file Simulator.cpp.
References m_bAutoGenerateRandomSeed.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Sets whether to automatically generate random seed.
bVal | true to generate automatic seed. |
Definition at line 725 of file Simulator.cpp.
References m_bAutoGenerateRandomSeed.
|
virtual |
Gets the background color.
Definition at line 1460 of file Simulator.cpp.
References m_vBackgroundColor.
Referenced by BackgroundColor(), and SetData().
|
virtual |
Sets the background color.
[in,out] | aryColor | The color data. |
Definition at line 1470 of file Simulator.cpp.
References m_lpWinMgr, m_vBackgroundColor, and AnimatSim::SimulationWindowMgr::UpdateBackgroundColor().
|
virtual |
Sets the background color.
[in,out] | vColor | Pointer to the color. |
Definition at line 1484 of file Simulator.cpp.
References BackgroundColor().
|
virtual |
Loads the background color from an XML data packet.
strXml | The color data in an xml data packet |
Definition at line 1498 of file Simulator.cpp.
References BackgroundColor(), and StdUtils::CStdColor::Load().
|
virtual |
Blocks the simulation from stepping.
The simulation and GUI are running in multi-threaded environment. When we make changes to the simulation from the GUI we need to block processing of the simulation thread while we make those changes to prevent memory corruption. This method initiates a block. We then call WaitForSimulationBlock to wait until the block takes effect before we make our changes.
Definition at line 2036 of file Simulator.cpp.
References m_bBlockSimulation.
|
protectedvirtual |
Calculates the snapshot byte size.
Reimplemented from AnimatSim::AnimatBase.
Definition at line 5157 of file Simulator.cpp.
References AnimatSim::Environment::Structure::CalculateSnapshotByteSize(), and m_aryAllStructures.
Referenced by InitializeStructures().
|
protectedvirtual |
Checks the simulation end time.
This checks whether the user has set the simulation to automatically end or not. If it has and the simulation time is greater than or equal to the end time then it stops the simulation. If we are running using the GUI then the m_lpSimCallback should be set. It pauses the simulation and then calls the NeedToStopSimulation event callback. This signals to the GUI that it needs to stop the simulation. If we are running standalone then the simulation is shutdown direclty.
Definition at line 2902 of file Simulator.cpp.
References m_bPaused, m_bSetEndSim, m_fltEndSimTime, m_lpSimCallback, AnimatSim::ISimGUICallback::NeedToStopSimulation(), PauseSimulation(), ShutdownSimulation(), and Time().
Referenced by ProcessSimulationStep().
|
protectedvirtual |
Checks whether or not a simulation block has been requested.
This is called within the StepSimulation code. It checks whether someone has requested a simulation block. If they have then it sets the m_bSimBlockConfirm flag to true. This blocks the simulation and lets the WaitForSimulationBlock code to proceed.
Definition at line 2119 of file Simulator.cpp.
References m_bBlockSimulation, and m_bSimBlockConfirm.
Referenced by ProcessSimulationStep().
|
protected |
Convert the string ID of the distance units to a conversion factor for the denominator of the distance units.
This determines the scaling factor that is used within the simulation to scale the arbitrary units to the denominator distance units chosen by the user.
strUnits | The string units. |
Definition at line 5369 of file Simulator.cpp.
References StdUtils::Std_CheckString().
Referenced by DistanceUnits().
|
protected |
Convert the string ID of the display units to a conversion factor.
Withing the GUI we sometimes have to use grams as the display unit. Then they can select Kg or mg, etc.. However, the standard units are usually 1 Kg, not 1 g. So we need to do a special conversion for these display units. So for example, Lets say the Mass units chosen is Kg, and they have a mass of 1 kg, then this would be 1000 grams/1000 = 1 Kg. However, if they set the units to be grams and had a 1 Kg mass then they would have 1000 grams/1 = 1 Kg.
strUnits | The string ID the display units. |
Definition at line 5457 of file Simulator.cpp.
References StdUtils::Std_CheckString().
Referenced by MassUnits().
|
protected |
Convert the string ID of the distance units to a conversion factor.
This determines the scaling factor that is used within the simulation to scale the arbitrary units to the distance units chosen by the user.
strUnits | The string ID the distance units. |
Definition at line 5326 of file Simulator.cpp.
References StdUtils::Std_CheckString().
Referenced by DistanceUnits().
|
protected |
Convert the string ID of the mass units to a conversion factor.
This determines the scaling factor that is used within the simulation to scale the arbitrary units to the mass units chosen by the user.
strUnits | The string ID the mass units. |
Definition at line 5412 of file Simulator.cpp.
References StdUtils::Std_CheckString().
Referenced by MassUnits().
|
static |
Creates a simulator from a specified file and initializes it.
This method is primarily used when running the simulator in stand-alone mode.
argc | The argc parameter from the command line. |
argv | The argv parameter from the command line. |
bForceNoWindows | If this is true then it forces no graphics windows to be created regardless of what the config file says. |
Definition at line 3568 of file Simulator.cpp.
References CreateSimulator(), Initialize(), and Load().
|
virtual |
Creates an object using a class factory.
The method takes a dll module name, a class name, and a class type and creates an object. The dll is loaded using the specified dll module name. A StdClassFactory pointer is retrieved from the dll, and then we call the CreateObject method of the class factory to create the actual object we need. This allows us to create objects of any type in a modular manner by simply specifying the name of the dll and the class we want.
strModule | The dll module name. |
strClassName | Name of the class to create. |
strType | The specific type of the class to create. |
bThrowError | true to throw error if there is a problem. |
Definition at line 3440 of file Simulator.cpp.
References StdUtils::IStdClassFactory::CreateObject(), FindNeuralModuleFactory(), LoadClassFactory(), m_lpAnimatClassFactory, m_strExecutablePath, and StdUtils::Std_CheckString().
Referenced by AnimatSim::Recording::SimulationRecorder::Add(), AnimatSim::SimulationWindowMgr::AddSimulationWindow(), AnimatSim::Environment::Joint::LoadConstraintFriction(), AnimatSim::Environment::Joint::LoadConstraintRelaxation(), AnimatSim::Charting::DataChartMgr::LoadDataChart(), AnimatSim::Charting::DataChart::LoadDataColumn(), AnimatSim::ExternalStimuli::ExternalStimuliMgr::LoadExternalStimuli(), AnimatSim::Behavior::NeuralModule::LoadExternalSynapse(), AnimatSim::Gains::LoadGain(), AnimatSim::Robotics::RobotInterface::LoadIOControl(), AnimatSim::Environment::RigidBody::LoadJoint(), AnimatSim::Recording::SimulationRecorder::LoadKeyFrame(), AnimatSim::Environment::LightManager::LoadLight(), FiringRateSim::FiringRateModule::LoadNeuron(), AnimatCarlSim::CsNeuralModule::LoadNeuronGroup(), LoadOrganism(), AnimatSim::Robotics::RobotIOControl::LoadPartInterface(), AnimatSim::Robotics::RemoteControl::LoadRemoteControlLinkage(), AnimatSim::Environment::RigidBody::LoadRigidBody(), AnimatSim::Environment::Organism::LoadRobotInterface(), AnimatSim::Environment::Structure::LoadRoot(), AnimatSim::Environment::Structure::LoadScript(), LoadScript(), AnimatSim::SimulationWindowMgr::LoadSimulationWindow(), FiringRateSim::Synapses::Synapse::LoadSynapse(), AnimatCarlSim::CsNeuralModule::LoadSynapse(), FiringRateSim::Neurons::Neuron::LoadSynapse(), OsgAnimatSim::OsgSimulator::SnapshotStopFrame(), and VortexAnimatSim::VsSimulator::SnapshotStopFrame().
|
protectedpure virtual |
Creates the simulation recorder.
Implemented in VortexAnimatSim::VsSimulator, and RoboticsAnimatSim::RbSimulator.
Referenced by Load().
|
static |
Creates a simulator from a simulator file.
strSimulationFile | The string simulation file. |
Definition at line 3604 of file Simulator.cpp.
References StdUtils::IStdClassFactory::CreateObject(), ExecutablePath(), LoadAnimatModuleName(), LoadClassFactory(), ProjectPath(), SimulationFile(), StdUtils::Std_ExecutablePath(), StdUtils::Std_FileExists(), StdUtils::Std_IsBlank(), StdUtils::Std_IsFullPath(), and StdUtils::Std_SplitPathAndFile().
Referenced by CreateAndInitializeSimulator(), and CreateSimulator().
|
static |
Creates a simulator from a specified file.
This method is primarily used when running the simulator in stand-alone mode.
argc | The argc parameter from the command line. |
argv | The argv parameter from the command line. |
bForceNoWindows | If this is true then it forces no graphics windows to be created regardless of what the config file says. |
Definition at line 3532 of file Simulator.cpp.
References CreateSimulator(), StdUtils::Std_DirectoryExists(), StdUtils::Std_ExecutablePath(), StdUtils::Std_IsBlank(), StdUtils::Std_SetLogFilePrefix(), and StdUtils::Std_SplitPathAndFile().
|
static |
Creates a simulator from an xml packet.
[in,out] | oXml | The xml to load. |
Definition at line 3682 of file Simulator.cpp.
References StdUtils::IStdClassFactory::CreateObject(), ExecutablePath(), LoadAnimatModuleName(), LoadClassFactory(), ProjectPath(), StdUtils::Std_ExecutablePath(), StdUtils::Std_IsBlank(), and StdUtils::Std_SplitPathAndFile().
|
static |
Creates a simulator from passed in settings..
strAnimatModule | name of the dll module to load for the class factory. |
strProjectPath | Full pathname of the string project file. |
strExecutablePath | Full pathname of the string executable file. |
Definition at line 3746 of file Simulator.cpp.
References StdUtils::IStdClassFactory::CreateObject(), ExecutablePath(), LoadClassFactory(), and ProjectPath().
|
static |
Creates a simulator from the command line.
This method is primarily used when running the simulator in stand-alone mode.
argc | The argc parameter from the command line. |
argv | The argv parameter from the command line. |
Definition at line 3493 of file Simulator.cpp.
References CreateSimulator(), StdUtils::Std_DirectoryExists(), StdUtils::Std_ExecutablePath(), StdUtils::Std_IsBlank(), StdUtils::Std_SetLogFilePrefix(), and StdUtils::Std_SplitPathAndFile().
|
virtual |
Gets the denominator distance units.
For items that use distance unit measures in the denominator we may want to use a differnt scale that that used for the whole app. For example, if we are using a distance scale of decimeters we will want to use centimeters for the density instead. This allows us to do that.
Definition at line 1756 of file Simulator.cpp.
References m_fltDenominatorDistanceUnits.
Referenced by AnimatSim::Environment::RigidBody::Density(), and AnimatSim::Environment::RigidBody::GetDensity().
|
virtual |
Gets the frame rate used for the simulation windows in cylces per second.
Definition at line 1044 of file Simulator.cpp.
References m_iDesiredFrameRate.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Sets the frame rate in cycles per second.
iVal | The new value. |
Definition at line 1066 of file Simulator.cpp.
References m_fltDesiredFrameStep, m_iDesiredFrameRate, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the frame step time.
This is the time between simulation frames.
Definition at line 1056 of file Simulator.cpp.
References m_fltDesiredFrameStep.
|
virtual |
Disables collision between the past-in body and all rigid bodies of the simulator.
[in,out] | lpBody | Pointer to a body. |
|
virtual |
Disables the video playback.
Definition at line 4988 of file Simulator.cpp.
References AnimatSim::Recording::KeyFrame::DisableVideoPlayback(), m_lpSimRecorder, and m_lpVideoPlayback.
|
virtual |
Gets the density mass units.
The editor will save out 1 Kg as 1000. So we need to convert 1000 to 1. We use this density mass unit value to do this.
Definition at line 1810 of file Simulator.cpp.
References m_fltDisplayMassUnits.
Referenced by AngularDamping(), AngularKineticLoss(), AnimatSim::Environment::RigidBody::AngularVelocityDamping(), AnimatSim::Environment::ConstraintRelaxation::Damping(), BulletAnimatSim::Environment::BlConstraintRelaxation::Damping(), VortexAnimatSim::Environment::VsMaterialType::Damping(), AnimatSim::Environment::Bodies::Spring::Damping(), AnimatSim::Environment::RigidBody::Density(), AnimatSim::Environment::RigidBody::GetDensity(), AnimatSim::Environment::RigidBody::GetMass(), LinearDamping(), LinearKineticLoss(), AnimatSim::Environment::RigidBody::LinearVelocityDamping(), and MouseSpringDamping().
|
virtual |
Sets the distance units.
The physcis engine in AnimatLab uses an arbitrary unit for mass and distance. It is up to the user to decide what those units are. So for example, one distance unit can be a standard meter, or it could be a centimeter. However, internally all distance measurements must remain consistent and be scaled by the same amount. This method calculates the conversion factor used throughout the simulation to insure that all distance units are scaled by the same values.
strUnits | The string identifer of the distance units to use. |
Definition at line 1717 of file Simulator.cpp.
References ConvertDenominatorDistanceUnits(), ConvertDistanceUnits(), m_fltDenominatorDistanceUnits, m_fltDistanceUnits, and m_fltInverseDistanceUnits.
Referenced by AnimatSim::Environment::MovableItem::AbsolutePosition(), AnimatSim::Environment::Bodies::LineBase::CalculateLength(), AnimatSim::Environment::OdorType::DiffusionConstant(), AnimatSim::Environment::RigidBody::GetVolume(), AnimatSim::Environment::MotorizedJoint::Initialize(), VortexAnimatSim::Visualization::ControlPoint::Position(), OsgAnimatSim::Visualization::ControlPoint::Position(), AnimatSim::Environment::MovableItem::Position(), AnimatSim::Environment::ContactSensor::ProcessContact(), AnimatSim::Environment::MotorizedJoint::ResetSimulation(), AnimatSim::Environment::MotorizedJoint::SetPosition(), and AnimatSim::Environment::MotorizedJoint::SetVelocity().
|
virtual |
Gets the distance units used in the simulation.
Definition at line 1732 of file Simulator.cpp.
References m_fltDistanceUnits.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Enables collision between the past-in body and all rigid bodies of the simulator.
[in,out] | lpBody | Pointer to a body. |
|
virtual |
Tells whehter simulation recording is enabled.
Definition at line 1871 of file Simulator.cpp.
References m_bEnableSimRecording.
|
virtual |
Sets whether simulation recording is Enabled.
bVal | true to enable. |
Definition at line 1881 of file Simulator.cpp.
References m_bEnableSimRecording.
|
virtual |
Enables the video playback.
strKeyFrameID | GUID ID for the string key frame. |
Definition at line 4970 of file Simulator.cpp.
References AnimatSim::Recording::KeyFrame::EnableVideoPlayback(), AnimatSim::ActivatedItemMgr::Find(), AnimatSim::AnimatBase::ID(), m_lpSimRecorder, and m_lpVideoPlayback.
|
virtual |
Gets the time at which to automatically end the simulation.
Definition at line 982 of file Simulator.cpp.
References m_fltEndSimTime.
Referenced by Load(), and SetData().
|
virtual |
Sets the time at which to automatically end the simulation.
fltVal | The new value. |
Definition at line 992 of file Simulator.cpp.
References m_fltEndSimTime, m_fltTimeStep, m_lEndSimTimeSlice, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the time slice at which to automatically end the simulation.
Definition at line 1008 of file Simulator.cpp.
References m_lEndSimTimeSlice.
|
virtual |
Sets the time slice at which to automatically end the simulation.
lVal | The new time slice value. |
Definition at line 1018 of file Simulator.cpp.
References m_fltEndSimTime, m_fltTimeStep, m_lEndSimTimeSlice, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the directory path to the executable.
Definition at line 307 of file Simulator.cpp.
References m_strExecutablePath.
Referenced by CreateSimulator().
|
virtual |
Sets the Executable path.
strPath | Full pathname to the executable file. |
Definition at line 317 of file Simulator.cpp.
References m_strExecutablePath.
|
virtual |
Searches for the object with the specified ID.
This loops through the list of all objects (m_aryObjectList) in the simulation and tries to find one with a matching ID.
strID | GUID ID for the object to find. |
bThrowError | true to throw error nothing is found. |
If | bThrowError=True and no objects is found it throws an exception. |
Definition at line 4008 of file Simulator.cpp.
References m_aryObjectList, and StdUtils::Std_CheckString().
Referenced by AddToObjectList(), AnimatSim::ExternalStimuli::EnablerStimulus::Initialize(), AnimatSim::Environment::ReceptiveFieldPair::Initialize(), AnimatSim::ExternalStimuli::ExternalInputStimulus::Initialize(), AnimatSim::ExternalStimuli::VoltageClamp::Initialize(), AnimatSim::Adapters::ContactAdapter::Initialize(), AnimatSim::ExternalStimuli::PropertyControlStimulus::Initialize(), AnimatSim::Adapters::PropertyControlAdapter::Initialize(), AnimatSim::ExternalStimuli::InverseMuscleCurrent::Initialize(), AnimatSim::Robotics::RobotPartInterface::Initialize(), AnimatSim::Charting::DataColumn::Initialize(), AnimatCarlSim::CsSynapseGroup::Initialize(), AnimatCarlSim::CsSpikingCurrentSynapse::Initialize(), FiringRateSim::Synapses::Synapse::Initialize(), AnimatSim::ExternalStimuli::CurrentStimulus::Initialize(), AnimatSim::Robotics::RemoteControlLinkage::Initialize(), VortexAnimatSim::Visualization::OsgLinearPath::Initialize(), OsgAnimatSim::Visualization::OsgLinearPath::Initialize(), AnimatSim::Adapters::Adapter::Initialize(), IntegrateFireSim::IntegrateFireNeuralModule::InitSynapse(), RemoveFromObjectList(), IntegrateFireSim::IntegrateFireNeuralModule::RemoveSynapseType(), AnimatSim::Environment::Bodies::OdorSensor::SetOdorTypePointer(), and AnimatSim::Environment::Bodies::Mouth::SetStomachPointer().
|
protectedvirtual |
Searches for the index of the food source.
[in,out] | lpFood | The pointer to a food source. |
Definition at line 4319 of file Simulator.cpp.
References m_aryFoodSources.
|
virtual |
Finds a joint with the specified ID in the specified structure.
Returns a pointer to the joint with the specified ID that is inside the specified structure if one is found. If either the structure or joint are not found then it will either throw an exception or return NULL depending on the value of bThrowError. This uses the FindStructureFromAll method to search both the "static" structures and the organisms for the specified StructureID.
strStructureID | GUID ID for the structure. |
strJointID | GUID ID for the joint. |
bThrowError | true to throw error if no structure is found. |
If | bThrowError=True and no structure or joint is found it throws an exception. |
Definition at line 3954 of file Simulator.cpp.
References AnimatSim::Environment::Structure::FindJoint(), and FindStructureFromAll().
Referenced by VortexAnimatSim::ExternalStimuli::VsMotorVelocityStimulus::Initialize(), and AnimatSim::ExternalStimuli::MotorStimulus::Initialize().
|
virtual |
Searches for the first neural module factory with the matching name.
strModuleName | Name of the string module to find. |
bThrowError | true to throw error if there is a problem. |
If | bThrowError=True and no factory is found it throws an exception. |
Definition at line 3807 of file Simulator.cpp.
References m_aryNeuralModuleFactories, and StdUtils::Std_CheckString().
Referenced by CreateObject().
|
virtual |
Searches for the first odor type with the specified ID.
strOdorID | GUID ID for the odor type. |
bThrowError | true to throw error if no odor type is found. |
If | bThrowError=True and no odor type is found it throws an exception. |
Definition at line 3891 of file Simulator.cpp.
References m_aryOdorTypes, and StdUtils::Std_CheckString().
Referenced by AnimatSim::Environment::Odor::SetOdorType().
|
virtual |
Searches for the first organism with the specified ID.
This searches only the organisms. It does not include structures.
strOrganismID | GUID ID for the organism. |
bThrowError | true to throw error if no organism is found. |
If | bThrowError=True and no organism is found it throws an exception. |
Definition at line 3835 of file Simulator.cpp.
References m_aryOrganisms, and StdUtils::Std_CheckString().
|
virtual |
Finds a rigid body with the specified ID in the specified structure.
Returns a pointer to the body with the specified ID that is inside the specified structure if one is found. If either the structure or body are not found then it will either throw an exception or return NULL depending on the value of bThrowError. This uses the FindStructureFromAll method to search both the "static" structures and the organisms for the specified StructureID.
strStructureID | GUID ID for the structure. |
strBodyID | GUID ID for the bodu. |
bThrowError | true to throw error if no structure is found. |
If | bThrowError=True and no structure or body is found it throws an exception. |
Definition at line 3983 of file Simulator.cpp.
References AnimatSim::Environment::Structure::FindRigidBody(), and FindStructureFromAll().
|
virtual |
Searches for the first structure with the specified ID.
This searches only the structures. It does not include organisms.
strStructureID | GUID ID for the structure. |
bThrowError | true to throw error if no structure is found. |
If | bThrowError=True and no structure is found it throws an exception. |
Definition at line 3865 of file Simulator.cpp.
References m_aryStructures, and StdUtils::Std_CheckString().
|
virtual |
Searches for the first structure with the specified ID.
This searches both the structures and organisms.
strStructureID | GUID ID for the structure. |
bThrowError | true to throw error if no structure is found. |
If | bThrowError=True and no structure is found it throws an exception. |
Definition at line 3920 of file Simulator.cpp.
References m_aryAllStructures, and StdUtils::Std_CheckString().
Referenced by FindJoint(), FindRigidBody(), AnimatSim::ExternalStimuli::ForceStimulus::Initialize(), VortexAnimatSim::Visualization::VsSimulationWindow::SetupTrackCamera(), and OsgAnimatSim::Visualization::OsgSimulationWindow::SetupTrackCamera().
|
virtual |
Gets whether we have set the simulation to force fast moving calculations.
Definition at line 695 of file Simulator.cpp.
References m_bForceFastMoving.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Set simulation to Force fast moving caculations.
bVal | true to force. |
Definition at line 705 of file Simulator.cpp.
References m_bForceFastMoving.
|
protectedvirtual |
Generates an automatic seed value based on the current time.
Definition at line 2876 of file Simulator.cpp.
References m_iManualRandomSeed, StdUtils::Std_IRand(), and StdUtils::Std_SRand().
Referenced by InitializeRandomNumbers().
|
virtual |
Gets the data chart manager.
Definition at line 400 of file Simulator.cpp.
References m_oDataChartMgr.
|
virtual |
Returns a float pointer to a data item of interest in this object.
This is a generic method used to get a pointer to data variable of interest. It is used by a variety of systems in the simulation. The most prominent are the data charting and stimulus classes. Within this method we associate a variable with a string name. By passing in the name of the data type we are interested in we can recieve back a float pointer to that data type. We can use that to read or set the data item in other classes. For example, the data charting system gets the pointer and then each time it needs to log a data point it reads the value into an array.
strDataType | name of the data item for which we are looking. |
If | DataType is not found. |
Reimplemented from AnimatSim::AnimatBase.
Reimplemented in VortexAnimatSim::VsSimulator, and OsgAnimatSim::OsgSimulator.
Definition at line 4581 of file Simulator.cpp.
References m_fltActualFrameRate, m_fltDataChartStepTime, m_fltExternalStimuliStepTime, m_fltMouseSpringDampingForceMagnitude, m_fltMouseSpringForceMagnitude, m_fltMouseSpringLengthMagnitude, m_fltPhysicsSubstepTime, m_fltPhysicsTimeStep, m_fltPlaybackAdditionRealTimeToStep, m_fltPrevPhysicsStepTime, m_fltRealTime, m_fltRemainingStepTime, m_fltSimRecorderStepTime, m_fltSimulationRealTimeToStep, m_fltTime, m_fltTotalMicroSleepCount, m_fltTotalMicroSleepTime, m_fltTotalMicroWaitCount, m_fltTotalMicroWaitTime, m_fltTotalNeuralStepTime, m_fltTotalRealTimeForStep, m_fltTotalRealTimeForStepSmooth, and StdUtils::Std_CheckString().
|
virtual |
Gets the external stimuli manager.
Definition at line 410 of file Simulator.cpp.
References m_oExternalStimuliMgr.
Referenced by AnimatSim::ExternalStimuli::ExternalStimulus::SetData().
|
virtual |
Gets the light manager.
Definition at line 430 of file Simulator.cpp.
References m_oLightMgr.
|
virtual |
Gets a material identifier from the physics engine for the specified unique ID.
This method must be implemented within the derived class for the physics engine.
strID | Identifier for the material. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 1434 of file Simulator.cpp.
|
virtual |
Gets the material manager.
Definition at line 440 of file Simulator.cpp.
References m_oMaterialMgr.
|
virtual |
Gets the simulation recorder.
Definition at line 420 of file Simulator.cpp.
References m_lpSimRecorder.
|
virtual |
Gets the window manager.
Definition at line 450 of file Simulator.cpp.
References m_lpWinMgr.
Referenced by VortexAnimatSim::Visualization::VsSimulationWindow::Initialize(), and OsgAnimatSim::Visualization::OsgSimulationWindow::Initialize().
|
virtual |
Gets the gravity value.
Definition at line 1225 of file Simulator.cpp.
References m_fltGravity.
Referenced by LoadEnvironment(), SetData(), and VortexAnimatSim::Environment::Bodies::VsFluidPlane::SetGravity().
|
virtual |
Sets the Gravity value.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 1236 of file Simulator.cpp.
References m_fltDistanceUnits, and m_fltGravity.
|
pure virtual |
Initializes this object.
This is a pure virtual method that must be implemented in the simulator application. It is where a lot of the nitty gritty details are done with initializing and setting up the physics engine so that it can run. It is also where we initialize each structure to tell them to create their parts and joints.
argc | The argc parameter from the command line. |
argv | The argv parameter from the command line. |
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
Referenced by CreateAndInitializeSimulator().
|
virtual |
Initializes this object with no argc/argv params.
This method initializes the simulation with no input params.
Reimplemented from AnimatSim::AnimatBase.
Definition at line 5304 of file Simulator.cpp.
Referenced by RunSimulation().
|
virtual |
Tells if the simulation has been initialized or not.
Definition at line 370 of file Simulator.cpp.
References m_bInitialized.
|
virtual |
Sets whether the simulation has been Initialized.
bVal | true if initialized. |
Definition at line 380 of file Simulator.cpp.
References m_bInitialized.
|
protectedvirtual |
Initializes the random number generation system.
Definition at line 1907 of file Simulator.cpp.
References GenerateAutoSeed(), m_bAutoGenerateRandomSeed, m_iManualRandomSeed, and StdUtils::Std_SRand().
Referenced by InitializeStructures(), and ResetSimulation().
|
protectedvirtual |
Initializes all of the structures of this simulation.
This method runs through all of the "static" structures and organisms and calls their Initialize method.
Definition at line 1928 of file Simulator.cpp.
References CalculateSnapshotByteSize(), AnimatSim::Environment::Materials::Initialize(), AnimatSim::AnimatBase::Initialize(), InitializeRandomNumbers(), m_aryAllStructures, m_bEnableSimRecording, m_bRecordVideo, m_fltPhysicsTimeStep, m_fltTimeStep, m_fltVideoEndTime, m_fltVideoRecordFrameTime, m_fltVideoStartTime, m_iVideoStep, m_iVideoStepSize, m_lSnapshotByteSize, m_lVideoEndSlice, m_lVideoStartSlice, m_oMaterialMgr, m_strProjectPath, m_strVideoFilename, and PhysicsTimeStep().
Referenced by RoboticsAnimatSim::RbSimulator::Initialize(), OsgAnimatSim::OsgSimulator::Initialize(), and VortexAnimatSim::VsSimulator::Initialize().
|
virtual |
Used to determine if we are running in a simulation, or in a real control mode.
The robotics simulation object will override this and return false to signify that it is in real-time control of physical hardware. Other simulator objects should leave this as true to signify that they are simulating the physical world. This are several places where we have to initialize things differently based on whether we are trying to run physical hardware or in simulation and this flag lets us know that.
Reimplemented in RoboticsAnimatSim::RbSimulator.
Definition at line 1673 of file Simulator.cpp.
Referenced by AnimatSim::Behavior::ThreadedModule::ExitPause(), AnimatSim::Robotics::RobotIOControl::ExitPause(), AnimatSim::Robotics::RobotIOControl::Initialize(), AnimatSim::Environment::MotorizedJoint::SetPosition(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataPWMOutput::SetupIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataDigitalInput::SetupIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataDigitalOutput::SetupIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataAnalogInput::SetupIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataHingeServo::SetupIO(), RoboticsAnimatSim::Robotics::RobotIOControls::DynamixelUSB::RbDynamixelUSBServo::SetupIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataDynamixelServo::SetupIO(), AnimatSim::Environment::MotorizedJoint::SetVelocity(), AnimatSim::Behavior::ThreadedModule::StartPause(), AnimatSim::Robotics::RobotIOControl::StartPause(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataDigitalOutput::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataDigitalInput::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataAnalogInput::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataPWMOutput::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataHingeServo::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::DynamixelUSB::RbDynamixelUSBServo::StepIO(), AnimatSim::Adapters::Adapter::StepSimulation(), RoboticsAnimatSim::Robotics::RobotIOControls::Firmata::RbFirmataDynamixelServo::Stop(), and AnimatSim::Robotics::RobotInterface::SynchSim().
|
virtual |
Gets the inverse distance units.
Definition at line 1742 of file Simulator.cpp.
References m_fltInverseDistanceUnits.
Referenced by AnimatSim::Environment::RigidBody::BuoyancyCenter(), BulletAnimatSim::Environment::BlConstraintRelaxation::CreateDefaultUnits(), VortexAnimatSim::Environment::VsMaterialType::CreateDefaultUnits(), VortexAnimatSim::Visualization::VsScriptedSimulationWindow::DefaultPosition(), OsgAnimatSim::Visualization::OsgScriptedSimulationWindow::DefaultPosition(), BulletAnimatSim::Environment::BlConstraintRelaxation::EqPos(), VortexAnimatSim::Environment::VsMaterialType::FrictionAngularNormalMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionAngularPrimaryMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionAngularSecondaryMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionLinearPrimaryMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionLinearSecondaryMax(), AnimatSim::Environment::Bodies::Cylinder::Height(), AnimatSim::Environment::Bodies::Cone::Height(), AnimatSim::Environment::Bodies::Box::Height(), AnimatSim::Environment::Bodies::Torus::InsideRadius(), AnimatSim::Environment::Bodies::Box::Length(), AnimatSim::Environment::ConstraintLimit::LimitPos(), AnimatSim::Environment::Bodies::Cone::LowerRadius(), AnimatSim::Environment::Bodies::Ellipsoid::MajorRadius(), VortexAnimatSim::Environment::VsMaterialType::MaxAdhesive(), AnimatSim::Environment::ConstraintFriction::MaxForce(), AnimatSim::Environment::MotorizedJoint::MaxForce(), AnimatSim::Environment::RigidBody::MaxHydroForce(), AnimatSim::Environment::RigidBody::MaxHydroTorque(), BulletAnimatSim::Environment::BlConstraintRelaxation::MaxLimit(), AnimatSim::Environment::MotorizedJoint::MaxVelocity(), AnimatSim::Environment::Bodies::Mouth::MinFoodRadius(), BulletAnimatSim::Environment::BlConstraintRelaxation::MinLimit(), AnimatSim::Environment::Bodies::Ellipsoid::MinorRadius(), MouseSpringDampingForceMagnitude(), MouseSpringForceMagnitude(), AnimatSim::Environment::Bodies::Spring::NaturalLength(), AnimatSim::Environment::Bodies::Torus::OutsideRadius(), OsgAnimatSim::Visualization::ControlPoint::Position(), VortexAnimatSim::Visualization::ControlPoint::Position(), AnimatSim::Environment::MovableItem::Position(), AnimatSim::Environment::Bodies::Sphere::Radius(), AnimatSim::Environment::Bodies::Cylinder::Radius(), AnimatSim::Environment::Bodies::Sensor::Radius(), AnimatSim::Environment::Light::Radius(), AnimatSim::Environment::Bodies::Mesh::SetBoundingBox(), AnimatSim::Environment::Bodies::Plane::Size(), AnimatSim::Environment::Joint::Size(), AnimatSim::Environment::Structure::Size(), VortexAnimatSim::Environment::VsMaterialType::SlideAngularNormal(), VortexAnimatSim::Environment::VsMaterialType::SlideAngularPrimary(), VortexAnimatSim::Environment::VsMaterialType::SlideAngularSecondary(), VortexAnimatSim::Environment::VsMaterialType::SlideLinearPrimary(), VortexAnimatSim::Environment::VsMaterialType::SlideLinearSecondary(), VortexAnimatSim::ExternalStimuli::VsMotorVelocityStimulus::StepSimulation(), AnimatSim::ExternalStimuli::MotorStimulus::StepSimulation(), AnimatSim::ExternalStimuli::ForceStimulus::StepSimulation(), AnimatSim::Environment::Bodies::Cone::UpperRadius(), AnimatSim::Environment::Bodies::FluidPlane::Velocity(), and AnimatSim::Environment::Bodies::Box::Width().
|
virtual |
Gets the inverse mass units.
Definition at line 1797 of file Simulator.cpp.
References m_fltInverseMassUnits.
Referenced by AnimatSim::Environment::ConstraintRelaxation::CreateDefaultUnits(), AnimatSim::Environment::ConstraintFriction::CreateDefaultUnits(), VortexAnimatSim::Environment::VsMaterialType::CreateDefaultUnits(), AnimatSim::Environment::ConstraintLimit::Damping(), VortexAnimatSim::Environment::VsMaterialType::FrictionAngularNormalMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionAngularPrimaryMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionAngularSecondaryMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionLinearPrimaryMax(), VortexAnimatSim::Environment::VsMaterialType::FrictionLinearSecondaryMax(), VortexAnimatSim::Environment::VsMaterialType::MaxAdhesive(), AnimatSim::Environment::ConstraintFriction::MaxForce(), AnimatSim::Environment::MotorizedJoint::MaxForce(), AnimatSim::Environment::RigidBody::MaxHydroForce(), AnimatSim::Environment::RigidBody::MaxHydroTorque(), MouseSpringDampingForceMagnitude(), MouseSpringForceMagnitude(), MouseSpringStiffness(), AnimatSim::ExternalStimuli::ForceStimulus::StepSimulation(), AnimatSim::Environment::ConstraintRelaxation::Stiffness(), AnimatSim::Environment::Bodies::Spring::Stiffness(), and AnimatSim::Environment::ConstraintLimit::Stiffness().
|
virtual |
Query if this object is physics being updated on this time slice.
Definition at line 1444 of file Simulator.cpp.
References m_iPhysicsStepCount, and m_iPhysicsStepInterval.
|
virtual |
Returns true if the simulation is in the process of resetting. False otherwise.
Definition at line 545 of file Simulator.cpp.
References m_bIsResetting.
|
virtual |
Gets the linear compliance of the simulation.
Definition at line 776 of file Simulator.cpp.
References m_fltLinearCompliance.
Referenced by SetData().
|
virtual |
Sets the linear compliance of the simulation.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 787 of file Simulator.cpp.
References m_fltLinearCompliance, m_fltMassUnits, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the linear damping of the simulation.
Definition at line 834 of file Simulator.cpp.
References m_fltLinearDamping.
Referenced by SetData().
|
virtual |
Sets the linear damping of the simulation.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 845 of file Simulator.cpp.
References DisplayMassUnits(), m_fltLinearDamping, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the linear kinetic loss of the simulation.
Definition at line 892 of file Simulator.cpp.
References m_fltLinearKineticLoss.
Referenced by SetData().
|
virtual |
Sets the linear kinetic loss of the simulation.
fltVal | The new value. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 902 of file Simulator.cpp.
References DisplayMassUnits(), m_fltLinearKineticLoss, and StdUtils::Std_IsAboveMin().
|
virtual |
Loads the simulation from an xml configuration file.
strFileName | The std::string to load. |
Definition at line 2933 of file Simulator.cpp.
References StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), StdUtils::CStdXml::Load(), m_strProjectPath, m_strSimulationFile, and StdUtils::Std_IsBlank().
Referenced by CreateAndInitializeSimulator(), and RunSimulation().
|
virtual |
Loads the item using an XML data packet.
This method is responsible for loading the structure from a XMl configuration file. You should call this method even in your overriden function becuase it loads all of the base properties for this object like ID and Name. It also includes this object in the simulators AddToObjectList so that the simulator knows about this object when you do a FindObject call. If you do not call this base method then it is up to you to add your item to the simulators list of objects.
[in,out] | oXml | The CStdXml xml data packet to load. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 2968 of file Simulator.cpp.
References AddToObjectList(), CreateSimulationRecorder(), EndSimTime(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::GetChildBool(), StdUtils::CStdXml::GetChildFloat(), StdUtils::CStdXml::GetChildInt(), StdUtils::CStdXml::GetChildString(), LoadEnvironment(), m_bEnableSimRecording, m_bPaused, m_fltEndSimTime, m_fltPresetPlaybackTimeStep, m_iPlaybackControlMode, m_lpSimRecorder, m_lpWinMgr, m_oDataChartMgr, m_oExternalStimuliMgr, m_strProjectPath, PlaybackControlMode(), PresetPlaybackTimeStep(), Reset(), SetEndSimTime(), and StdUtils::Std_IsBlank().
|
staticprotected |
Loads an animat module name.
strFile | The string file. | |
[in,out] | strAnimatModule | The string animat module. |
Definition at line 3364 of file Simulator.cpp.
References StdUtils::Std_FileExists().
Referenced by CreateSimulator().
|
staticprotected |
Loads an animat module name.
[in,out] | oXml | The xml. |
[in,out] | strAnimatModule | The string animat module. |
Definition at line 3410 of file Simulator.cpp.
References StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), and StdUtils::CStdXml::GetChildString().
|
static |
Loads the class factory specified in the DLL module name.
strModuleName | Name of the dll module. |
Throws | an exception if there is an error creating the class factory. |
Definition at line 3019 of file Simulator.cpp.
References StdUtils::Std_ToLower().
Referenced by CreateObject(), CreateSimulator(), and AnimatSim::Behavior::NervousSystem::LoadNeuralModule().
|
protectedvirtual |
Loads all structures from from the configuration file for this simulation.
[in,out] | oXml | The xml. |
Definition at line 3077 of file Simulator.cpp.
References AutoGenerateRandomSeed(), DesiredFrameRate(), DistanceUnits(), StdUtils::CStdXml::FindChildByIndex(), StdUtils::CStdXml::FindChildElement(), ForceFastMoving(), StdUtils::CStdXml::GetChildBool(), StdUtils::CStdXml::GetChildFloat(), StdUtils::CStdXml::GetChildInt(), StdUtils::CStdXml::GetChildString(), Gravity(), StdUtils::CStdXml::IntoChildElement(), StdUtils::CStdXml::IntoElem(), StdUtils::CStdColor::Load(), LoadOdorType(), LoadOrganism(), LoadScript(), LoadStructure(), m_aryOdorTypes, m_aryOrganisms, m_aryStructures, m_bAutoGenerateRandomSeed, m_bForceFastMoving, m_bSimulateHydrodynamics, m_fltAlphaThreshold, m_fltGravity, m_fltMouseSpringStiffness, m_fltPhysicsTimeStep, m_fltRecFieldSelRadius, m_fltStabilityScale, m_ftlMouseSpringDamping, m_iDesiredFrameRate, m_iManualRandomSeed, m_iPhysicsSubsteps, m_lpAnimatClassFactory, m_oLightMgr, m_oMaterialMgr, m_vBackgroundColor, ManualRandomSeed(), MassUnits(), MouseSpringDamping(), MouseSpringStiffness(), StdUtils::CStdXml::NumberOfChildren(), StdUtils::CStdXml::OutOfElem(), SimulateHydrodynamics(), and StabilityScale().
Referenced by Load().
|
virtual |
Loads a key frame snapshot.
[in,out] | aryBytes | Array of bytes for the snapshot. |
[in,out] | lIndex | Index into the byte array. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 5200 of file Simulator.cpp.
References AnimatSim::Environment::Structure::LoadKeyFrameSnapshot(), and m_aryAllStructures.
Loads an odor type.
[in,out] | oXml | The xml that defines the odor type to load. |
Throws | an exception if there is a problem creating or loading the odor type. |
Definition at line 3278 of file Simulator.cpp.
References AnimatSim::AnimatBase::SetSystemPointers().
Referenced by LoadEnvironment().
Loads an organism.
[in,out] | oXml | The xml that defines the organism to load. |
Throws | an exception if there is a problem creating or loading the organism. |
Definition at line 3229 of file Simulator.cpp.
References AddOrganism(), CreateObject(), StdUtils::CStdXml::GetChildString(), StdUtils::CStdXml::IntoElem(), and StdUtils::CStdXml::OutOfElem().
Referenced by AddOrganism(), and LoadEnvironment().
|
protectedvirtual |
Loads the script.
[in,out] | oXml | The xml data packet to load. |
Definition at line 3316 of file Simulator.cpp.
References CreateObject(), StdUtils::CStdXml::GetChildString(), StdUtils::CStdXml::IntoElem(), AnimatSim::AnimatBase::Load(), StdUtils::CStdXml::OutOfElem(), and AnimatSim::AnimatBase::SetSystemPointers().
Referenced by AddScript(), and LoadEnvironment().
Loads a structure.
[in,out] | oXml | The xml that defines the structure to load. |
Throws | an exception if there is a problem creating or loading the structure. |
Definition at line 3191 of file Simulator.cpp.
References AddStructure(), StdUtils::IStdClassFactory::CreateObject(), and m_lpAnimatClassFactory.
Referenced by AddStructure(), and LoadEnvironment().
|
virtual |
Gets the manual random seed value.
Definition at line 735 of file Simulator.cpp.
References m_iManualRandomSeed.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Sets the manual random seed value.
iSeed | The seed. |
Definition at line 745 of file Simulator.cpp.
References m_iManualRandomSeed.
|
virtual |
Gets whether the simulation is being stepped manually by the user.
Definition at line 653 of file Simulator.cpp.
References m_bManualStepSimulation.
|
virtual |
Sets whether the simulation is being stepped manually by the user.
bVal | true to step manually. |
Definition at line 663 of file Simulator.cpp.
References m_bManualStepSimulation.
|
virtual |
Sets the mass units.
The physcis engine in AnimatLab uses an arbitrary unit for mass and distance. It is up to the user to decide what those units are. So for example, one mass unit can be a standard kilogram, or it could be a gram. However, internally all mass measurements must remain consistent and be scaled by the same amount. This method calculates the conversion factor used throughout the simulation to insure that all distance units are scaled by the same values.
strUnits | The std::string identifer of the mass units to use. |
Definition at line 1772 of file Simulator.cpp.
References ConvertDisplayMassUnits(), ConvertMassUnits(), m_fltDisplayMassUnits, m_fltInverseMassUnits, and m_fltMassUnits.
Referenced by VortexAnimatSim::Environment::VsMaterialType::Compliance(), VortexAnimatSim::Environment::VsConstraintRelaxation::CreateDefaultUnits(), AnimatSim::Environment::ConstraintFriction::CreateDefaultUnits(), VortexAnimatSim::Environment::VsMaterialType::CreateDefaultUnits(), VortexAnimatSim::Environment::VsConstraintRelaxation::Loss(), AnimatSim::Environment::ConstraintFriction::Loss(), VortexAnimatSim::Environment::VsMaterialType::SlipAngularNormal(), VortexAnimatSim::Environment::VsMaterialType::SlipAngularPrimary(), VortexAnimatSim::Environment::VsMaterialType::SlipAngularSecondary(), VortexAnimatSim::Environment::VsMaterialType::SlipLinearPrimary(), and VortexAnimatSim::Environment::VsMaterialType::SlipLinearSecondary().
|
virtual |
Gets the mass units.
Definition at line 1787 of file Simulator.cpp.
References m_fltMassUnits.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Gets the current simulation time in millisecond.
Definition at line 569 of file Simulator.cpp.
References Time().
|
virtual |
Calculates the number of time slices from a supplied number of milliseconds.
lMillisecond | The millisecond to convert. |
Definition at line 581 of file Simulator.cpp.
References m_fltTimeStep.
|
virtual |
Gets the mouse spring damping.
The user can grab onto objects using a mouse spring. This sets the damping of that spring.
Definition at line 1286 of file Simulator.cpp.
References m_ftlMouseSpringDamping.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Sets the mouse spring damping.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Definition at line 1297 of file Simulator.cpp.
References DisplayMassUnits(), m_ftlMouseSpringDamping, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the magnitude of the mouse spring damping force applied at each time step.
Definition at line 1342 of file Simulator.cpp.
References m_fltMouseSpringDampingForceMagnitude.
|
virtual |
Sets the mouse spring damping force that was used in the current timestep. This is for reporting purposes only.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Definition at line 1353 of file Simulator.cpp.
References InverseDistanceUnits(), InverseMassUnits(), and m_fltMouseSpringDampingForceMagnitude.
|
virtual |
Gets the magnitude of the mouse spring force applied at each time step.
Definition at line 1314 of file Simulator.cpp.
References m_fltMouseSpringForceMagnitude.
|
virtual |
Sets the mouse spring force that was used in the current timestep. This is for reporting purposes only.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Definition at line 1325 of file Simulator.cpp.
References InverseDistanceUnits(), InverseMassUnits(), and m_fltMouseSpringForceMagnitude.
|
virtual |
Gets the magnitude of the mouse spring length at each time step.
Definition at line 1370 of file Simulator.cpp.
References m_fltMouseSpringLengthMagnitude.
|
virtual |
Sets the mouse spring length that was used in the current timestep. This is for reporting purposes only.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Definition at line 1381 of file Simulator.cpp.
References m_fltDistanceUnits, and m_fltMouseSpringLengthMagnitude.
|
virtual |
Gets the mouse spring stiffness.
The user can grab onto objects using a mouse spring. This sets the stiffness of that spring.
Definition at line 1255 of file Simulator.cpp.
References m_fltMouseSpringStiffness.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Sets the mouse spring stiffness.
fltVal | The new value. |
bUseScaling | true to use unit scaling. |
Definition at line 1266 of file Simulator.cpp.
References InverseMassUnits(), m_fltMouseSpringStiffness, and StdUtils::Std_IsAboveMin().
|
virtual |
Move key frame.
strID | GUID ID for the key frame. |
lStart | The start time slice. |
lEnd | The end time slice. |
Definition at line 5110 of file Simulator.cpp.
References AnimatSim::Recording::SimulationRecorder::Add(), AnimatSim::ActivatedItem::EndSlice(), AnimatSim::ActivatedItemMgr::Find(), AnimatSim::AnimatBase::ID(), m_lpSimRecorder, AnimatSim::ActivatedItemMgr::Remove(), AnimatSim::ActivatedItem::StartSlice(), and AnimatSim::AnimatBase::Type().
|
virtual |
Move simulation to key frame.
strKeyFrameID | GUID ID for the key frame. |
Definition at line 5135 of file Simulator.cpp.
References AnimatSim::ActivatedItemMgr::Find(), m_lpSimRecorder, m_lpSimStopPoint, AnimatSim::Recording::KeyFrame::MakeCurrentFrame(), and StdUtils::Std_IsBlank().
|
protectedvirtual |
Notifies the objects that time step has been modified.
Definition at line 1987 of file Simulator.cpp.
References m_aryObjectList, and AnimatSim::AnimatBase::TimeStepModified().
Referenced by SetData().
|
virtual |
Gets the list of pointers to all objects in the simulation.
Definition at line 390 of file Simulator.cpp.
References m_aryObjectList.
|
virtual |
Gets whether the Simulation is paused.
Definition at line 347 of file Simulator.cpp.
References m_bPaused.
Referenced by AnimatSim::ActivatedItem::Enabled(), AnimatSim::Behavior::ThreadedModule::ExitPause(), AnimatSim::Robotics::RobotIOControl::ExitPause(), AnimatSim::Behavior::ThreadedModule::StartPause(), AnimatSim::Robotics::RobotIOControl::StartPause(), HybridInterfaceSim::Robotics::HiSpike2::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::RbAnimatSerial::StepIO(), RoboticsAnimatSim::Robotics::RobotIOControls::RbXBeeCommander::StepIO(), AnimatSim::Robotics::PulsedLinkage::StepIO(), and AnimatCarlSim::CsNeuralModule::stepUpdate().
|
virtual |
Sets the Paused flag.
This mutator should not called to pause the simulation. If you want to pause the simulation you need to call the PauseSimulation method.
bVal | true to value. |
Definition at line 360 of file Simulator.cpp.
References m_bPaused.
|
pure virtual |
Pauses the simulation.
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
Referenced by CheckEndSimulationTime().
|
virtual |
Gets the physics time slice count.
Definition at line 633 of file Simulator.cpp.
References m_lPhysicsSliceCount.
|
virtual |
Sets the physics time slice count.
lVal | The new value. |
Definition at line 643 of file Simulator.cpp.
References m_lPhysicsSliceCount.
|
virtual |
Gets the physics step count.
This is a counter that keeps track of how many time slices have occured since the StepSimulation method started. We use this to know how many more slices to go until the physics engine steps.
Definition at line 1176 of file Simulator.cpp.
References m_iPhysicsStepCount.
Referenced by VortexAnimatSim::ExternalStimuli::VsMotorVelocityStimulus::StepSimulation(), AnimatSim::ExternalStimuli::MotorStimulus::StepSimulation(), AnimatSim::ExternalStimuli::PropertyControlStimulus::StepSimulation(), and AnimatSim::ExternalStimuli::ForceStimulus::StepSimulation().
|
virtual |
Gets the physics step interval.
This is the physics time step divided by the m_fltTimeStep. m_fltTimeStep is the smallest integration time step in the system. So this is how many total time slices occur between each iteration of the physics engine.
Definition at line 1097 of file Simulator.cpp.
References m_iPhysicsStepInterval.
Referenced by PhysicsTimeStep(), VortexAnimatSim::ExternalStimuli::VsMotorVelocityStimulus::StepSimulation(), AnimatSim::ExternalStimuli::MotorStimulus::StepSimulation(), AnimatSim::ExternalStimuli::PropertyControlStimulus::StepSimulation(), and AnimatSim::ExternalStimuli::ForceStimulus::StepSimulation().
|
virtual |
Sets the physics step interval.
This is the physics time step divided by the m_fltTimeStep. m_fltTimeStep is the smallest integration time step in the system. So this is how many total time slices occur between each iteration of the physics engine.
iVal | The new value. |
Definition at line 1111 of file Simulator.cpp.
References m_iPhysicsStepInterval, and StdUtils::Std_IsAboveMin().
|
virtual |
This is used only for the bullet physics engine. It allows the user to specify how many substeps should be made for the physics time step specified. This allows you to keep the overall physics time step you wanted but subdivide it more finely if that is required. However, The larger this number the slower your simulation will run.
iVal | New substeps greater than 0. |
Definition at line 1189 of file Simulator.cpp.
References m_fltPhysicsSubstepTime, m_fltPhysicsTimeStep, m_iPhysicsSubsteps, and StdUtils::Std_IsAboveMin().
|
virtual |
Gets the physics substeps.
Definition at line 1205 of file Simulator.cpp.
References m_iPhysicsSubsteps.
Referenced by SetData().
|
virtual |
Gets the physics substep time.
Definition at line 1215 of file Simulator.cpp.
References m_fltPhysicsSubstepTime.
|
virtual |
Sets the integration time step for the physics engine.
fltVal | The new value. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 1126 of file Simulator.cpp.
References m_fltPhysicsSubstepTime, m_fltPhysicsTimeStep, m_fltTimeStep, m_iPhysicsStepInterval, m_iPhysicsSubsteps, PhysicsStepInterval(), and StdUtils::Std_IsAboveMin().
Referenced by BulletAnimatSim::Environment::Joints::BlPrismatic::ApplyMotorAssist(), BulletAnimatSim::Environment::Joints::BlHinge::ApplyMotorAssist(), AnimatSim::Environment::Bodies::Spring::CalculateTension(), AnimatSim::Environment::Bodies::LinearHillMuscle::CalculateTension(), AnimatSim::Environment::RigidBody::CreateParts(), AnimatSim::ExternalStimuli::InverseMuscleCurrent::Initialize(), AnimatSim::Environment::Bodies::Stomach::StepSimulation(), AnimatSim::Environment::BodyPart::SynchUpdateInterval(), AnimatSim::Adapters::Adapter::SynchUpdateInterval(), AnimatSim::Adapters::Adapter::SynchUpdateStartInterval(), and AnimatSim::Behavior::PhysicsNeuralModule::TimeStep().
|
virtual |
Gets the integration time step for the physics engine.
Definition at line 1163 of file Simulator.cpp.
References m_fltPhysicsTimeStep.
Referenced by InitializeStructures(), and SetData().
|
virtual |
Gets the playback control mode.
The follow playback control modes are supported.
Definition at line 1559 of file Simulator.cpp.
References m_iPlaybackControlMode.
Referenced by Load(), and SetData().
|
virtual |
Sets the playback control mode.
The follow playback control modes are supported.
iMode | The playback mode to use. |
Definition at line 1585 of file Simulator.cpp.
References m_iPlaybackControlMode.
|
virtual |
Gets the preset playback time step.
If the playback control mode is set to use a preset value for the playback time step then this is the time step used.
Definition at line 1603 of file Simulator.cpp.
References m_fltPresetPlaybackTimeStep.
Referenced by Load(), and SetData().
|
virtual |
Sets the preset playback time step in milliseconds.
If the playback control mode is set to use a preset value for the playback time step then this is the time step used.
lTimeStep | The time step to use. |
Definition at line 1617 of file Simulator.cpp.
References m_fltPresetPlaybackTimeStep.
|
protectedvirtual |
Process the an entire step of the simulation. This includes the simulation portion, video and calculating timing.
Definition at line 2652 of file Simulator.cpp.
References CheckEndSimulationTime(), CheckSimulationBlock(), StdUtils::CStdErrorInfo::m_strError, and StepSimulation().
Referenced by Simulate().
|
virtual |
Gets the project path.
Definition at line 287 of file Simulator.cpp.
References m_strProjectPath.
Referenced by CreateSimulator(), VortexAnimatSim::VsSimulator::GenerateCollisionMeshFile(), and AnimatSim::Charting::DataChartMgr::LoadDataChart().
|
virtual |
Sets the project path.
strPath | Full pathname of the project file. |
Definition at line 297 of file Simulator.cpp.
References m_strProjectPath.
|
virtual |
Queries this object for a list of properties that can be changed using SetData.
The method provides a list of the properties that can be set using the SetData method. It gives the property name and the type of data that should be passed to it. Valid date types are Boolean, Float, Integer, and Xml.
aryNames | Array list of the property names. |
strTypes | Array list of the type that is associated with the cooresponding name in the list. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 4817 of file Simulator.cpp.
References AnimatSim::AnimatBase::QueryProperties().
|
virtual |
Returns the real time since the simulation was started.
Definition at line 1082 of file Simulator.cpp.
References m_fltRealTime.
|
protectedvirtual |
Record video frame.
Definition at line 5217 of file Simulator.cpp.
Referenced by StepPhysicsEngine().
|
virtual |
Removes an object from the list of all simulation objects.
[in,out] | lpItem | Pointer to the item to remove. |
Definition at line 4084 of file Simulator.cpp.
References FindByID(), AnimatSim::AnimatBase::ID(), and m_aryObjectList.
Referenced by AnimatSim::AnimatBase::~AnimatBase().
|
virtual |
Removes a child item from this parent.
This is a generic method that is used to delete a child object from this parent. The GUI uses this method to remove objects from the simulation that have been deleted in the UI. The item type lets the method determine what type of item is being deleted, like synapse, neuron, body part, etc.. The ID is then used to delete that specific item.
strItemType | String descriptor of the type of item that is being created. |
strID | Unique ID of the item that will be removed. |
bThrowError | If true then throw an error if there is a problem, otherwise return false. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 4916 of file Simulator.cpp.
References m_oDataChartMgr, m_oExternalStimuliMgr, m_oLightMgr, m_oMaterialMgr, AnimatSim::Charting::DataChartMgr::RemoveDataChart(), AnimatSim::Environment::Materials::RemoveItem(), AnimatSim::Environment::LightManager::RemoveItem(), RemoveOrganism(), RemoveScript(), AnimatSim::ExternalStimuli::ExternalStimuliMgr::RemoveStimulus(), RemoveStructure(), and StdUtils::Std_CheckString().
|
virtual |
Removes the key frame described by strID.
strID | GUID ID for the key frame. |
Definition at line 5090 of file Simulator.cpp.
References m_lpSimRecorder, and AnimatSim::ActivatedItemMgr::Remove().
|
protectedvirtual |
Removes an organism by its ID.
This is primarily used by the GUI to remove an organism from the simulation.
strID | GUID ID of the organism to remove. |
bThrowError | true to throw error if the organism is not found. |
Definition at line 4404 of file Simulator.cpp.
References m_aryAllStructures, and m_aryOrganisms.
Referenced by RemoveItem().
|
protectedvirtual |
Removes the script based on ID.
This is primarily used by the GUI to remove the script from the structure when the user does this in the GUI.
strID | GUI ID of the script to remove |
bThrowError | If true then throw an error if there is a problem, otherwise return false |
Definition at line 4566 of file Simulator.cpp.
References AnimatSim::AnimatBase::ID().
Referenced by RemoveItem().
|
protectedvirtual |
Removes a structure by its ID.
This is primarily used by the GUI to remove a structure from the simulation.
strID | Identifier for the structure. |
bThrowError | true to throw error if the structure is not found. |
Definition at line 4460 of file Simulator.cpp.
References m_aryAllStructures, and m_aryStructures.
Referenced by RemoveItem().
|
virtual |
Resets all objects of the simulation to their unloaded state.
Use this function to completely reset a simulation to its initial default settings. This will destroy all organisms and strcutres defined within the simulation
Reimplemented from AnimatSim::AnimatBase.
Reimplemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
Definition at line 2141 of file Simulator.cpp.
References AnimatSim::SimulationWindowMgr::Close(), m_aryAllStructures, m_aryExtraDataParts, m_aryFoodSources, m_aryNeuralModuleFactories, m_aryOdorTypes, m_aryOrganisms, m_arySourcePhysicsAdapters, m_aryStructures, m_aryTargetPhysicsAdapters, m_bEnableSimRecording, m_bForceFastMoving, m_bInitialized, m_bPaused, m_bRecordVideo, m_bRobotAdpaterSynch, m_bShuttingDown, m_bSimRunning, m_bSimulateHydrodynamics, m_bSteppingSim, m_fltActualFrameRate, m_fltAngularCompliance, m_fltAngularDamping, m_fltAngularKineticLoss, m_fltDataChartStepTime, m_fltDenominatorDistanceUnits, m_fltDesiredFrameStep, m_fltDisplayMassUnits, m_fltDistanceUnits, m_fltEndSimTime, m_fltExternalStimuliStepTime, m_fltGravity, m_fltInverseDistanceUnits, m_fltInverseMassUnits, m_fltLinearCompliance, m_fltLinearDamping, m_fltLinearKineticLoss, m_fltMassUnits, m_fltMouseSpringDampingForceMagnitude, m_fltMouseSpringForceMagnitude, m_fltMouseSpringLengthMagnitude, m_fltMouseSpringStiffness, m_fltPhysicsStepTime, m_fltPhysicsSubstepTime, m_fltPhysicsTimeStep, m_fltPlaybackAdditionRealTimeToStep, m_fltPresetPlaybackTimeStep, m_fltPrevPhysicsStepTime, m_fltPrevTotalRealTimeForStep, m_fltRealTime, m_fltRemainingStepTime, m_fltSimRecorderStepTime, m_fltSimulationRealTimeToStep, m_fltStabilityScale, m_fltTime, m_fltTimeStep, m_fltTotalMicroSleepCount, m_fltTotalMicroSleepTime, m_fltTotalMicroWaitCount, m_fltTotalMicroWaitTime, m_fltTotalNeuralStepTime, m_fltTotalRealTimeForStep, m_fltTotalRealTimeForStepSmooth, m_fltVideoEndTime, m_fltVideoPlaybackFrameTime, m_fltVideoRecordFrameTime, m_fltVideoStartTime, m_ftlMouseSpringDamping, m_iDesiredFrameRate, m_iExtraDataCount, m_iPhysicsBodyCount, m_iPhysicsStepCount, m_iPhysicsStepInterval, m_iPhysicsSubsteps, m_iPlaybackControlMode, m_iTargetAdapterCount, m_iVideoLoops, m_iVideoStepSize, m_lpAnimatClassFactory, m_lPhysicsSliceCount, m_lpSelOrganism, m_lpSelStructure, m_lpSimCallback, m_lpSimRecorder, m_lpSimStopPoint, m_lpVideoPlayback, m_lpVideoRecorder, m_lpWinMgr, m_lSnapshotByteSize, m_lTimeSlice, m_lVideoEndSlice, m_lVideoFrame, m_lVideoSliceCount, m_lVideoStartSlice, m_oDataChartMgr, m_oExternalStimuliMgr, m_oLightMgr, m_oMaterialMgr, m_strVideoFilename, AnimatSim::Environment::Materials::Reset(), AnimatSim::ActivatedItemMgr::Reset(), and AnimatSim::AnimatBase::Reset().
Referenced by Load().
|
virtual |
Resets the the simulation to its orginal settings at time 0.
Reimplemented from AnimatSim::AnimatBase.
Reimplemented in VortexAnimatSim::VsSimulator, and RoboticsAnimatSim::RbSimulator.
Definition at line 2304 of file Simulator.cpp.
References InitializeRandomNumbers(), m_aryAllStructures, m_arySourcePhysicsAdapters, m_aryTargetPhysicsAdapters, m_bIsResetting, m_bPaused, m_bSimRunning, m_fltMouseSpringDampingForceMagnitude, m_fltMouseSpringForceMagnitude, m_fltMouseSpringLengthMagnitude, m_fltTime, m_iPhysicsStepCount, m_lPhysicsSliceCount, m_lpSimRecorder, m_lpWinMgr, m_lTimeSlice, m_lVideoSliceCount, m_oDataChartMgr, m_oExternalStimuliMgr, m_oLightMgr, AnimatSim::ActivatedItemMgr::ResetSimulation(), AnimatSim::SimulationWindowMgr::ResetSimulation(), AnimatSim::AnimatBase::ResetSimulation(), and AnimatSim::Environment::Structure::ResetSimulation().
|
protectedvirtual |
Resets the variables that are used to keep track of the time that each component of the time step takes to execute.
Definition at line 2582 of file Simulator.cpp.
References m_fltDataChartStepTime, m_fltExternalStimuliStepTime, m_fltPhysicsStepTime, m_fltPrevPhysicsStepTime, m_fltRemainingStepTime, m_fltSimRecorderStepTime, and m_fltTotalNeuralStepTime.
Referenced by StepSimulation().
|
virtual |
Gets whether we need to synch the physics adapters in a simulation to the robot physics time step.
Definition at line 1645 of file Simulator.cpp.
References m_bRobotAdpaterSynch.
Referenced by AnimatSim::Adapters::Adapter::StepSimulation(), and AnimatSim::Robotics::RobotInterface::SynchSim().
|
virtual |
Sets whether we need to synch the physics adapters in a simulation to the robot physics time step.
bVal | new value. |
Definition at line 1655 of file Simulator.cpp.
References m_bRobotAdpaterSynch.
|
virtual |
Runs the simulation.
This is different from the Simulate method. This is used when the AnimatSimulator is running standalone. It Loads the simulation from the specified file, initailizes it, and the calls Simulate.
This is primarily used when running the simulation in stand-alone mode. It loads the project file, initializes the simulation, and the calls Simulate.
Definition at line 2702 of file Simulator.cpp.
References Initialize(), Load(), Simulate(), and SimulationFile().
|
virtual |
Saves the simulation file.
strFilename | The std::string to save. |
Reimplemented in VortexAnimatSim::VsSimulator, and OsgAnimatSim::OsgSimulator.
Definition at line 2965 of file Simulator.cpp.
|
virtual |
Saves a key frame snapshot.
[in,out] | aryBytes | Array of bytes for the snapshot. |
[in,out] | lIndex | Index into the byte array. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 5180 of file Simulator.cpp.
References m_aryAllStructures, and AnimatSim::Environment::Structure::SaveKeyFrameSnapshot().
|
virtual |
Saves a video.
strPath | Full pathname of the string file. |
Definition at line 5052 of file Simulator.cpp.
References m_lpSimRecorder, m_lpVideoPlayback, and AnimatSim::Recording::KeyFrame::SaveVideo().
|
virtual |
Set a variable based on a string data type name.
This is a generic method that can be used to set any variable in an AnimatBase object by specifying the name of the variable and a string representation of that data. The GUI uses this method to set data into variables in the simulation when the user changes them in the UI. The value string can be as simple as a float or int, or as complex as an xml packet. It is the developers responsibilty to know what type of data is needed and to process it accordingly.
strDataType | string name of the data type to set. |
strValue | The string value of the data. It is up to the developer to determine what this should be. For example, in most cases it is simply a float and you just have to convert it to a float and make the appropriate mutator method call. However, it can be any type of string, including an entire xml packet. It is the developers responsibility to know how to set and process the data as required. |
bThrowError | true to throw error if there is a problem. If false then it will not return an error, just return false. |
Reimplemented from AnimatSim::AnimatBase.
Definition at line 4636 of file Simulator.cpp.
References StdUtils::CStdColor::a(), AddBodiesMode(), AngularCompliance(), AngularDamping(), AngularKineticLoss(), AutoGenerateRandomSeed(), StdUtils::CStdColor::b(), BackgroundColor(), DesiredFrameRate(), DistanceUnits(), EndSimTime(), ForceFastMoving(), StdUtils::CStdColor::g(), Gravity(), LinearCompliance(), LinearDamping(), LinearKineticLoss(), m_vBackgroundColor, ManualRandomSeed(), MassUnits(), MouseSpringDamping(), MouseSpringStiffness(), NotifyTimeStepModified(), PhysicsSubsteps(), PhysicsTimeStep(), PlaybackControlMode(), PresetPlaybackTimeStep(), StdUtils::CStdColor::r(), SetEndSimTime(), SimulateHydrodynamics(), StabilityScale(), StdUtils::Std_CheckString(), StdUtils::Std_ToBool(), and VisualSelectionMode().
|
virtual |
Gets whether to use the set simulation end time.
Definition at line 962 of file Simulator.cpp.
References m_bSetEndSim.
Referenced by Load(), and SetData().
|
virtual |
Sets whether to use the simulation end time.
bVal | true to use simulation end time. |
Definition at line 972 of file Simulator.cpp.
References m_bSetEndSim.
|
pure virtual |
Shuts down the simulation.
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
Referenced by CheckEndSimulationTime().
|
virtual |
Tells whether the simulation is shutting down or not.
This is used by other objects in their destructor to determine whether to make certain calls or not.
Definition at line 685 of file Simulator.cpp.
References m_bShuttingDown.
Referenced by AnimatSim::Environment::RigidBody::~RigidBody().
|
virtual |
Calback object from the simulation.
This class allows the simulation to make callbacks to the GUI.
Definition at line 525 of file Simulator.cpp.
References m_lpSimCallback.
|
virtual |
Sets the calback object from the simulation.
This class allows the simulation to make callbacks to the GUI.
[in,out] | lpCallback | Pointer to a callback. |
Definition at line 537 of file Simulator.cpp.
References m_lpSimCallback.
|
protectedvirtual |
Simulation pausing event.
This method is called on all objects when the simulation begins pausing. It is to let the objects know about this event so they can do any pre-processing required before the simulation pauses.
Reimplemented from AnimatSim::AnimatBase.
Definition at line 2739 of file Simulator.cpp.
References m_aryObjectList, and AnimatSim::AnimatBase::SimPausing().
Referenced by RoboticsAnimatSim::RbSimulator::PauseSimulation(), OsgAnimatSim::OsgSimulator::PauseSimulation(), VortexAnimatSim::VsSimulator::PauseSimulation(), RoboticsAnimatSim::RbSimulator::ToggleSimulation(), OsgAnimatSim::OsgSimulator::ToggleSimulation(), and VortexAnimatSim::VsSimulator::ToggleSimulation().
|
virtual |
Gets whether the simulation is running.
Definition at line 673 of file Simulator.cpp.
References m_bSimRunning.
Referenced by AnimatSim::PidControl::Enabled(), AnimatSim::Node::Enabled(), AnimatSim::Environment::MotorizedJoint::EnableMotor(), AnimatSim::Environment::Bodies::Stomach::EnergyLevel(), AnimatSim::Environment::RigidBody::FoodQuantity(), VortexAnimatSim::Visualization::VsScriptedSimulationWindow::TrackCamera(), OsgAnimatSim::Visualization::OsgScriptedSimulationWindow::TrackCamera(), and FiringRateSim::Neurons::Neuron::Vrest().
|
protectedvirtual |
Simulation starting event.
This method is called on all objects when the simulation begins starting. It is to let the objects know about this event so they can do any pre-processing required before the simulation starts.
Reimplemented from AnimatSim::AnimatBase.
Definition at line 2718 of file Simulator.cpp.
References m_aryObjectList, and AnimatSim::AnimatBase::SimStarting().
Referenced by RoboticsAnimatSim::RbSimulator::StartSimulation(), OsgAnimatSim::OsgSimulator::StartSimulation(), VortexAnimatSim::VsSimulator::StartSimulation(), RoboticsAnimatSim::RbSimulator::ToggleSimulation(), OsgAnimatSim::OsgSimulator::ToggleSimulation(), and VortexAnimatSim::VsSimulator::ToggleSimulation().
|
protectedvirtual |
Simulation stopping event.
This method is called on all objects when the simulation begins stopping. It is to let the objects know about this event so they can do any pre-processing required before the simulation stops.
Reimplemented from AnimatSim::AnimatBase.
Definition at line 2760 of file Simulator.cpp.
References m_aryObjectList, m_fltTime, and AnimatSim::AnimatBase::SimStopping().
Referenced by RoboticsAnimatSim::RbSimulator::ShutdownSimulation(), OsgAnimatSim::OsgSimulator::ShutdownSimulation(), VortexAnimatSim::VsSimulator::ShutdownSimulation(), RoboticsAnimatSim::RbSimulator::StopSimulation(), OsgAnimatSim::OsgSimulator::StopSimulation(), and VortexAnimatSim::VsSimulator::StopSimulation().
|
virtual |
Simulates the system.
This starts the simulation running. This method does not return until the simulation has been stopped. It is a blocking call. It loops through and calls the Step method repeatedly.
Definition at line 2680 of file Simulator.cpp.
References m_bForceSimulationStop, m_bStopSimulation, ProcessSimulationStep(), SimulateBegin(), and SimulateEnd().
Referenced by RunSimulation().
|
protectedvirtual |
Called at the beginning of the Simulate method.
Definition at line 2622 of file Simulator.cpp.
References m_bSteppingSim, m_lLastTickTaken, m_lStartSimTick, m_lStepSimEndTick, m_lStepStartTick, and m_lVideoFrameStartTick.
Referenced by Simulate().
|
protectedvirtual |
Called at the end of the Simulate method.
Reimplemented in VortexAnimatSim::VsSimulator, and RoboticsAnimatSim::RbSimulator.
Definition at line 2642 of file Simulator.cpp.
Referenced by Simulate().
|
virtual |
Gets whether the simulation uses hydrodynamics.
Tells whether or not we will be doing hydrodynamic simulations. If you are not doing stuff underwater then be sure this is set to false. The hydrodynamics adds extra overhead that can slow the simulation down slightly.
Definition at line 1402 of file Simulator.cpp.
References m_bSimulateHydrodynamics.
Referenced by LoadEnvironment(), SetData(), and AnimatSim::Environment::RigidBody::StepSimulation().
|
virtual |
Sets whether the simulation uses hydrodynamics.
Tells whether or not we will be doing hydrodynamic simulations. If you are not doing stuff underwater then be sure this is set to false. The hydrodynamics adds extra overhead that can slow the simulation down slightly.
bVal | true use hydrodynamics. |
Definition at line 1417 of file Simulator.cpp.
References m_bSimulateHydrodynamics.
|
virtual |
Confirms that the simulation has been blocked.
The simulation and GUI are running in multi-threaded environment. When we make changes to the simulation from the GUI we need to block processing of the simulation thread while we make those changes to prevent memory corruption. This method tells whether the simulation has been blocked.
Definition at line 2062 of file Simulator.cpp.
References m_bSimBlockConfirm.
|
virtual |
Gets the simulation filename.
Definition at line 327 of file Simulator.cpp.
References m_strSimulationFile.
Referenced by CreateSimulator(), and RunSimulation().
|
virtual |
Sets the simulation filename.
strFile | The simulation filename. |
Definition at line 337 of file Simulator.cpp.
References m_strSimulationFile.
|
virtual |
Calculates the number of milliseconds from a supplied number of time slices.
lSlice | The time slices to convert. |
Definition at line 593 of file Simulator.cpp.
References m_fltTimeStep.
|
virtual |
Gets the snapshot byte size.
Definition at line 1891 of file Simulator.cpp.
References m_lSnapshotByteSize.
|
protectedpure virtual |
Takes a snapshot of the current frame.
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
|
virtual |
Sets the linear scaling factor that controls the simulation stability parameters.
Definition at line 755 of file Simulator.cpp.
References m_fltStabilityScale.
Referenced by LoadEnvironment(), and SetData().
|
virtual |
Sets the linear scaling factor that controls the simulation stability parameters.
fltVal | Scale factor. |
Reimplemented in VortexAnimatSim::VsSimulator.
Definition at line 765 of file Simulator.cpp.
References m_fltStabilityScale.
|
virtual |
The time slice tick at which the simulation start.
Definition at line 603 of file Simulator.cpp.
References m_lStartSimTick.
|
pure virtual |
Starts the simulation.
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
|
virtual |
Starts a video playback.
Definition at line 5003 of file Simulator.cpp.
References m_lpSimRecorder, m_lpVideoPlayback, and AnimatSim::Recording::KeyFrame::StartVideoPlayback().
|
protectedvirtual |
Steps the simulation forward by one time slice.
Definition at line 2557 of file Simulator.cpp.
References m_fltTime, m_fltTimeStep, m_iPhysicsStepCount, m_iPhysicsStepInterval, m_lpSimRecorder, m_lTimeSlice, StepNeuralEngine(), and StepPhysicsEngine().
Referenced by StepSimulation().
|
protectedvirtual |
Step the neural engine of each organism.
Definition at line 2449 of file Simulator.cpp.
References m_aryOrganisms, m_fltTotalNeuralStepTime, m_lpSelOrganism, m_oOrganismIterator, and AnimatSim::Environment::Organism::StepNeuralEngine().
Referenced by Step().
|
protectedvirtual |
Calls StepPhysicsEngine of all structures.
Definition at line 2498 of file Simulator.cpp.
References m_aryAllStructures, m_aryTargetPhysicsAdapters, m_bRecordVideo, m_fltPhysicsStepTime, m_iTargetAdapterCount, m_lPhysicsSliceCount, m_lpSelStructure, m_oStructureIterator, RecordVideoFrame(), AnimatSim::Environment::Structure::StepPhysicsEngine(), and StepSimulation().
Referenced by Step().
|
protectedvirtual |
Steps the entire simulation forward by one physics integration time step.
This method steps the entire simulation forward by one physics time step. Remember that there are typically multiple neural steps for a given physcis step, so this will step the simulation as a whole several times for a given physics time step. It goes through and calls StepSimulation for every structure/organism object, which in turn calls StepSimulation for each rigid body and joint of each of those objects. So you need to be VERY careful to keep all code within the StepSimulation methods short, sweet, and very fast. They are in the main processing loop and even a small increase in the amount of processing time that occurrs within this loop will lead to major impacts on the ultimate performance of the system.
Reimplemented from AnimatSim::AnimatBase.
Reimplemented in VortexAnimatSim::VsSimulator, and RoboticsAnimatSim::RbSimulator.
Definition at line 2609 of file Simulator.cpp.
References m_iPhysicsStepCount, m_iPhysicsStepInterval, ResetSimulationTimingParams(), and Step().
Referenced by ProcessSimulationStep(), and StepPhysicsEngine().
|
virtual |
Step video playback.
iFrameCount | Number of frames. |
Definition at line 5035 of file Simulator.cpp.
References m_lpSimRecorder, m_lpVideoPlayback, and AnimatSim::Recording::KeyFrame::StepVideoPlayback().
|
virtual |
Tells if the simulation has been stopped.
Definition at line 1034 of file Simulator.cpp.
References m_bForceSimulationStop, and m_bStopSimulation.
|
pure virtual |
Stops the simulation and resets it.
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
|
virtual |
Stop video playback.
Definition at line 5018 of file Simulator.cpp.
References m_lpSimRecorder, m_lpVideoPlayback, and AnimatSim::Recording::KeyFrame::StopVideoPlayback().
|
virtual |
Gets the current simulation time in seconds.
Definition at line 559 of file Simulator.cpp.
References m_fltTime.
Referenced by CheckEndSimulationTime(), AnimatSim::ExternalStimuli::CurrentStimulus::GetCurrentOn(), Millisecond(), AnimatSim::ExternalStimuli::ExternalInputStimulus::StepSimulation(), VortexAnimatSim::VsSimulator::StepSimulation(), VortexAnimatSim::ExternalStimuli::VsMotorVelocityStimulus::StepSimulation(), AnimatSim::ExternalStimuli::MotorStimulus::StepSimulation(), AnimatSim::ExternalStimuli::PropertyControlStimulus::StepSimulation(), AnimatSim::ExternalStimuli::InverseMuscleCurrent::StepSimulation(), AnimatSim::ExternalStimuli::ForceStimulus::StepSimulation(), AnimatSim::Charting::DataChart::StepSimulation(), AnimatSim::Adapters::Adapter::StepSimulation(), FiringRateSim::Neurons::Neuron::StepSimulation(), VortexAnimatSim::Visualization::VsScriptedSimulationWindow::TrackCamera(), and OsgAnimatSim::Visualization::OsgScriptedSimulationWindow::TrackCamera().
|
virtual |
Gets the current time slice.
Definition at line 613 of file Simulator.cpp.
References m_lTimeSlice.
Referenced by AnimatSim::ExternalStimuli::CurrentStimulus::Activate(), IntegrateFireSim::IntegrateFireNeuralModule::CalcUpdate(), AnimatSim::ActivatedItem::Enabled(), AnimatSim::ActivatedItem::NeedToActivate(), AnimatSim::ActivatedItem::NeedToDeactivate(), AnimatSim::Charting::ArrayChart::StepSimulation(), AnimatSim::Charting::MemoryChart::StepSimulation(), AnimatSim::Environment::Bodies::Mouth::StepSimulation(), AnimatSim::ExternalStimuli::CurrentStimulus::StepSimulation(), AnimatSim::Charting::DataChart::StepSimulation(), and AnimatSim::Environment::RigidBody::StepSimulation().
|
virtual |
Sets the current time slice.
lVal | The new value. |
Definition at line 623 of file Simulator.cpp.
References m_lTimeSlice.
|
virtual |
Gets the smallest integration time step used within the simulation.
This is the base time step that is used for the individual time slice.
Definition at line 951 of file Simulator.cpp.
References m_fltTimeStep.
Referenced by AnimatSim::ExternalStimuli::CurrentStimulus::BurstOffDuration(), AnimatSim::ExternalStimuli::CurrentStimulus::BurstOnDuration(), AnimatSim::Charting::DataChart::CollectInterval(), AnimatSim::Charting::DataChart::CollectTimeWindow(), AnimatSim::ExternalStimuli::CurrentStimulus::CycleOffDuration(), AnimatSim::ExternalStimuli::CurrentStimulus::CycleOnDuration(), AnimatSim::ExternalStimuli::InverseMuscleCurrent::Initialize(), AnimatSim::Charting::DataChart::Initialize(), AnimatSim::Charting::DataChart::ReInitialize(), AnimatSim::Charting::FileChart::SaveOutput(), and AnimatSim::Behavior::NeuralModule::TimeStep().
|
pure virtual |
Toggles the simulation between running and paused.
Implemented in VortexAnimatSim::VsSimulator, OsgAnimatSim::OsgSimulator, and RoboticsAnimatSim::RbSimulator.
|
virtual |
Unblock simulation.
The simulation and GUI are running in multi-threaded environment. When we make changes to the simulation from the GUI we need to block processing of the simulation thread while we make those changes to prevent memory corruption. This method unblocks the simulation to allow processing to resume.
Definition at line 2048 of file Simulator.cpp.
References m_bBlockSimulation, and m_bSimBlockConfirm.
|
virtual |
Gets the video loops.
Definition at line 1844 of file Simulator.cpp.
References m_iVideoLoops.
|
virtual |
Sets the video loops.
iVal | The new value. |
Definition at line 1854 of file Simulator.cpp.
References m_iVideoLoops.
|
virtual |
Gets the video playback frame.
Definition at line 1860 of file Simulator.cpp.
References m_lpVideoPlayback.
|
virtual |
Sets the video playback frame.
[in,out] | lpFrame | Pointer to the video playback frame. |
|
virtual |
Gets the video recorder.
Definition at line 1857 of file Simulator.cpp.
References m_lpVideoRecorder.
|
virtual |
Sets the video recorder.
[in,out] | lpFrame | Pointer to a frame. |
|
virtual |
Gets the video slice count.
Definition at line 1824 of file Simulator.cpp.
References m_lVideoSliceCount.
|
virtual |
Sets the video slice count.
lVal | The new value. |
Definition at line 1834 of file Simulator.cpp.
References m_lVideoSliceCount.
|
virtual |
Gets the visual selection mode.
Definition at line 460 of file Simulator.cpp.
References m_iSelectionMode.
Referenced by SetData().
|
virtual |
Sets the visual selection mode.
This loops through all ojects in the simulation and calls VisualSelectionModeChanged to let it know when the selection mode has changed in the GUI.
iVal | The new value. |
Definition at line 473 of file Simulator.cpp.
References m_aryObjectList, m_iSelectionMode, and AnimatSim::AnimatBase::VisualSelectionModeChanged().
|
virtual |
Wait for simulation block.
The simulation and GUI are running in multi-threaded environment. When we make changes to the simulation from the GUI we need to block processing of the simulation thread while we make those changes to prevent memory corruption. This method sets the block simulation variable to true, and then waits until the simulation block is confirmed or a timeout occurs.
lTimeout | The timeout period in time slices. |
Definition at line 2079 of file Simulator.cpp.
References m_bBlockSimulation, m_bSimBlockConfirm, and m_bSteppingSim.
|
protected |
A list of all structures, both regular structures and organisms. This is a reference list.
Definition at line 59 of file Simulator.h.
Referenced by CalculateSnapshotByteSize(), FindStructureFromAll(), InitializeStructures(), LoadKeyFrameSnapshot(), RemoveOrganism(), RemoveStructure(), Reset(), ResetSimulation(), SaveKeyFrameSnapshot(), StepPhysicsEngine(), and ~Simulator().
|
protected |
Array of parts that need extra data collected from them. Each part will have its UpdateExtraData method called after all parts have been stepped.
Definition at line 91 of file Simulator.h.
Referenced by AfterStepSimulation(), Reset(), and ~Simulator().
|
protected |
A list of class factories for neural modules that have been loaded by any organisms in the environment. Each factory is only added to the list once even if the the same module is loaded seperately for each organism.
Definition at line 71 of file Simulator.h.
Referenced by FindNeuralModuleFactory(), Reset(), and ~Simulator().
|
protected |
A list of all odors in this simulation. This is not a reference list It is an actual list that destroys its objects when the list is destroyed.
Definition at line 63 of file Simulator.h.
Referenced by FindOdorType(), LoadEnvironment(), Reset(), and ~Simulator().
|
protected |
A list of all Organisms in this simulation. This is not a reference list It is an actual list that destroys its objects when the list is destroyed.
Definition at line 50 of file Simulator.h.
Referenced by FindOrganism(), LoadEnvironment(), RemoveOrganism(), Reset(), StepNeuralEngine(), and ~Simulator().
|
protected |
A list of structures in this simulation that are not organisms. This is not a reference list. It is an actual list that destroys its objects when the list is destroyed.
Definition at line 55 of file Simulator.h.
Referenced by FindStructure(), LoadEnvironment(), RemoveStructure(), Reset(), and ~Simulator().
|
protected |
Determines whether a random seed is automatically generated when the simulation is initialized, or if a manual seed is used.
Definition at line 287 of file Simulator.h.
Referenced by AutoGenerateRandomSeed(), InitializeRandomNumbers(), LoadEnvironment(), and Simulator().
|
protected |
If this has been set to true then we have are in a simulation of a robot and we should only update the physics adapters with the same frequency as would happen in the real robot.
Definition at line 325 of file Simulator.h.
Referenced by Reset(), RobotAdpaterSynch(), and Simulator().
|
protected |
Tells whether or not we will be doing hydrodynamic simulations. If you are not doing stuff underwater then be sure this is set to false. The hydrodynamics adds extra overhead that can slow the simulation down slightly.
Definition at line 234 of file Simulator.h.
Referenced by LoadEnvironment(), Reset(), SimulateHydrodynamics(), and Simulator().
|
protected |
For items that use distance unit measures in the denominator we may want to use a differnt scale that that used for the whole app. For example, if we are using a distance scale of decimeters we will want to use centimeters for the density instead. This allows us to do that.
Definition at line 191 of file Simulator.h.
Referenced by DenominatorDistanceUnits(), DistanceUnits(), Reset(), and Simulator().
|
protected |
This keeps track of the substep time to use based on the number of substeps specified. This is PhysicsTimeStep/iPhysicsSubteps
Definition at line 248 of file Simulator.h.
Referenced by GetDataPointer(), PhysicsSubsteps(), PhysicsSubstepTime(), PhysicsTimeStep(), Reset(), and Simulator().
|
protected |
This is the total number of milliseconds that is added by the playback control to match the desired playback rate. This is a float so that it can easily be reported.
Definition at line 363 of file Simulator.h.
Referenced by GetDataPointer(), Reset(), and Simulator().
|
protected |
The time step you want to use for playback if the playback control mode is set to a preset value. This value is in milliseconds.
Definition at line 336 of file Simulator.h.
Referenced by Load(), PresetPlaybackTimeStep(), Reset(), and Simulator().
|
protected |
This is the previous time pers step for the physics engine. This time is a weird one. It really gets calculated after we have updated the data in the chart, so we need to use the value from the previous time step to get the real value correctly.
Definition at line 386 of file Simulator.h.
Referenced by GetDataPointer(), Reset(), ResetSimulationTimingParams(), and Simulator().
|
protected |
The radius of the sphere shown for a receptive field. This is used in the selection code so we can show the selected vertex. It adds a sphere to the part at that vertex coordinate and uses this radius when drawing the sphere.
Definition at line 317 of file Simulator.h.
Referenced by LoadEnvironment(), and Simulator().
|
protected |
This is the time left over from subtracting all the calculated times form the total time for the step. This is primarily used for debuggin purposes to make sure that I have not missed anything.
Definition at line 402 of file Simulator.h.
Referenced by GetDataPointer(), Reset(), ResetSimulationTimingParams(), and Simulator().
|
protected |
This is the total number of milliseconds for the simulation processing time. This is a float so that it can easily be reported.
Definition at line 346 of file Simulator.h.
Referenced by GetDataPointer(), Reset(), and Simulator().
|
protected |
If the AutoGenerateRandomSeed variable is false then this manual seed is used for the random number generator.
Definition at line 291 of file Simulator.h.
Referenced by GenerateAutoSeed(), InitializeRandomNumbers(), LoadEnvironment(), ManualRandomSeed(), and Simulator().
|
protected |
This is the number of physics bodies within the simulation. This is used to setup the presets for the simulation.
Definition at line 321 of file Simulator.h.
Referenced by Reset(), and Simulator().
|
protected |
This keeps track of the number of steps since the physics system was last updated. By using this we do not have to do a bunch of divisions at each time step to determine if it is time to update the physics engine.
Definition at line 283 of file Simulator.h.
Referenced by IsPhysicsBeingUpdated(), PhysicsStepCount(), Reset(), ResetSimulation(), Simulator(), Step(), and StepSimulation().
|
protected |
This tells how many time slices occur between each interval where the body physics is updated. There could be multiple neural updates in between one physics update.
Definition at line 275 of file Simulator.h.
Referenced by IsPhysicsBeingUpdated(), PhysicsStepInterval(), PhysicsTimeStep(), Reset(), Simulator(), Step(), and StepSimulation().
|
protected |
This is used only for the bullet physics engine. It allows the user to specify how many substeps should be made for the physics time step specified. This allows you to keep the overall physics time step you wanted but subdivide it more finely if that is required. However, The larger this number the slower your simulation will run.
Definition at line 244 of file Simulator.h.
Referenced by LoadEnvironment(), PhysicsSubsteps(), PhysicsTimeStep(), Reset(), and Simulator().
|
protected |
This is a copy of the class factory associated with the animat module. This is the default class factory that is used if no specific module name is specified. If a specific name is given then it looks through the list of modules that were loaded for neural modules. All class factories should have have NO state.
Definition at line 78 of file Simulator.h.
Referenced by CreateObject(), LoadEnvironment(), LoadStructure(), RoboticsAnimatSim::RbSimulator::Reset(), VortexAnimatSim::VsSimulator::Reset(), Reset(), Simulator(), and ~Simulator().
|
protected |
Pointer to a simulation callback class. This is only set if we are using the GUI. This is set by the managed wrapper to allow us to post callback notifications to the GUI.
Definition at line 131 of file Simulator.h.
Referenced by CheckEndSimulationTime(), Reset(), SimCallback(), SimCallBack(), Simulator(), and ~Simulator().