AnimatLab  2
Test
RoboticsAnimatSim::RbSimulator Class Reference
+ Inheritance diagram for RoboticsAnimatSim::RbSimulator:
+ Collaboration diagram for RoboticsAnimatSim::RbSimulator:

Public Member Functions

virtual void ConvertV1MeshFile (std::string strOriginalMeshFile, std::string strNewMeshFile, std::string strTexture)
 
virtual void GenerateCollisionMeshFile (std::string strOriginalMeshFile, std::string strCollisionMeshFile, float fltScaleX, float fltScaleY, float fltScaleZ)
 
virtual void GetPositionAndRotationFromD3DMatrix (float(&aryTransform)[4][4], CStdFPoint &vPos, CStdFPoint &vRot)
 
virtual unsigned long long GetTimerTick ()
 
virtual void Initialize (int argc, const char **argv)
 Initializes this object. More...
 
virtual bool InSimulation ()
 Used to determine if we are running in a simulation, or in a real control mode. More...
 
virtual void MicroSleep (unsigned int iMicroTime)
 
virtual bool PauseSimulation ()
 Pauses the simulation. More...
 
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 void ShutdownSimulation ()
 Shuts down the simulation. More...
 
virtual bool StartSimulation ()
 Starts the simulation. More...
 
virtual void StopSimulation ()
 Stops the simulation and resets it. More...
 
virtual double TimerDiff_m (unsigned long long lStart, unsigned long long lEnd)
 
virtual double TimerDiff_n (unsigned long long lStart, unsigned long long lEnd)
 
virtual double TimerDiff_s (unsigned long long lStart, unsigned long long lEnd)
 
virtual double TimerDiff_u (unsigned long long lStart, unsigned long long lEnd)
 
virtual void ToggleSimulation ()
 Toggles the simulation between running and paused. More...
 
virtual void WriteToConsole (std::string strMessage)
 
- Public Member Functions inherited from AnimatSim::Simulator
 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 CStdColorBackgroundColor ()
 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 CStdSerializeCreateObject (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 AnimatBaseFindByID (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 JointFindJoint (std::string strStructureID, std::string strJointID, bool bThrowError=true)
 Finds a joint with the specified ID in the specified structure. More...
 
virtual IStdClassFactoryFindNeuralModuleFactory (std::string strModuleName, bool bThrowError=false)
 Searches for the first neural module factory with the matching name. More...
 
virtual OdorTypeFindOdorType (std::string strOdorID, bool bThrowError=true)
 Searches for the first odor type with the specified ID. More...
 
virtual OrganismFindOrganism (std::string strOrganismID, bool bThrowError=true)
 Searches for the first organism with the specified ID. More...
 
virtual RigidBodyFindRigidBody (std::string strStructureID, std::string strBodyID, bool bThrowError=true)
 Finds a rigid body with the specified ID in the specified structure. More...
 
virtual StructureFindStructure (std::string strStructureID, bool bThrowError=true)
 Searches for the first structure with the specified ID. More...
 
virtual StructureFindStructureFromAll (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 DataChartMgrGetDataChartMgr ()
 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 ExternalStimuliMgrGetExternalStimuliMgr ()
 Gets the external stimuli manager. More...
 
virtual LightManagerGetLightMgr ()
 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 MaterialsGetMaterialMgr ()
 Gets the material manager. More...
 
virtual SimulationRecorderGetSimulationRecorder ()
 Gets the simulation recorder. More...
 
virtual SimulationWindowMgrGetWindowMgr ()
 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 ()
 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 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 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 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 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 ScriptProcessorScript ()
 
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 bool ShuttingDown ()
 Tells whether the simulation is shutting down or not. More...
 
virtual ISimGUICallbackSimCallback ()
 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 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 StopVideoPlayback ()
 Stop video playback. More...
 
virtual float Time ()
 Gets the current simulation time in seconds. More...
 
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 UnblockSimulation ()
 Unblock simulation. More...
 
virtual int VideoLoops ()
 Gets the video loops. More...
 
virtual void VideoLoops (int iVal)
 Sets the video loops. More...
 
virtual KeyFrameVideoPlayback ()
 Gets the video playback frame. More...
 
virtual void VideoPlayback (KeyFrame *lpFrame)
 Sets the video playback frame. More...
 
virtual KeyFrameVideoRecorder ()
 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...
 
- 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 NeuralModuleGetNeuralModule ()
 Gets the neural module. More...
 
virtual NodeGetNode ()
 Gets the node. More...
 
virtual SimulatorGetSimulator ()
 Gets the simulator pointer. More...
 
virtual StructureGetStructure ()
 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...
 

Protected Member Functions

virtual AnimatSim::Recording::SimulationRecorderCreateSimulationRecorder ()
 Creates the simulation recorder. More...
 
void InitializeRobotics (int argc, const char **argv)
 
void SetSimulationStabilityParams ()
 
virtual void SimulateEnd ()
 Called at the end of the Simulate method. More...
 
virtual void SnapshotStopFrame ()
 Takes a snapshot of the current frame. More...
 
virtual void StepSimulation ()
 Steps the entire simulation forward by one physics integration time step. More...
 
virtual void UpdateSimulationWindows ()
 
- Protected Member Functions inherited from AnimatSim::Simulator
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 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...
 
OdorTypeLoadOdorType (CStdXml &oXml)
 Loads an odor type. More...
 
OrganismLoadOrganism (CStdXml &oXml)
 Loads an organism. More...
 
virtual ScriptProcessorLoadScript (CStdXml &oXml)
 Loads the script. More...
 
StructureLoadStructure (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 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 StepVideoFrame ()
 
virtual double TimeBetweenVideoFrames ()
 

Protected Attributes

double m_dblTotalVortexStepTime
 
long m_lStepVortexTimeCount
 
- Protected Attributes inherited from AnimatSim::Simulator
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.
 
IStdClassFactorym_lpAnimatClassFactory
 
long m_lPhysicsSliceCount
 The number of slices that the physics engine has been updated.
 
ThreadProcessorm_lpIOThread
 The pointer to an i/o thread processor.
 
ThreadProcessorm_lpNeuralThread
 The pointer to a neural thread processor.
 
ThreadProcessorm_lpPhysicsThread
 The pointer to the physics thread processor.
 
ScriptProcessorm_lpScript
 
Organism * m_lpSelOrganism
 The pointer to a selected organism.
 
Structure * m_lpSelStructure
 The pointer to a selected structure.
 
ISimGUICallbackm_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.
 
SimulationWindowMgrm_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::NeuralModulem_lpModule
 The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NULL.
 
Nodem_lpNode
 The pointer to this items parent Node. If this is not relevant for this object then this is NULL.
 
Simulatorm_lpSim
 The pointer to a Simulation.
 
AnimatSim::Environment::Structurem_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..
 

Additional Inherited Members

- Static Public Member Functions inherited from AnimatSim::Simulator
static SimulatorCastToDerived (AnimatBase *lpBase)
 
static SimulatorCreateAndInitializeSimulator (std::string strSimFile, bool bForceNoWindows=false)
 Creates a simulator from a specified file and initializes it. More...
 
static SimulatorCreateSimulator (std::string strAnimatModule, std::string strSimulationFile, bool bForceNoWindows=false)
 Creates a simulator from a simulator file. More...
 
static SimulatorCreateSimulator (std::string strSimFile, bool bForceNoWindows=false)
 Creates a simulator from a specified file. More...
 
static SimulatorCreateSimulator (std::string strAnimatModule, CStdXml &oXml)
 Creates a simulator from an xml packet. More...
 
static SimulatorCreateSimulator (std::string strAnimatModule, std::string strProjectPath, std::string strExecutablePath)
 Creates a simulator from passed in settings.. More...
 
static SimulatorCreateSimulator (int argc, const char **argv)
 Creates a simulator from the command line. More...
 
static IStdClassFactoryLoadClassFactory (std::string strModuleName, bool bThrowError=true)
 Loads the class factory specified in the DLL module name. More...
 
- Static Protected Member Functions inherited from AnimatSim::Simulator
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...
 

Detailed Description

Definition at line 14 of file RbSimulator.h.

Member Function Documentation

SimulationRecorder * RoboticsAnimatSim::RbSimulator::CreateSimulationRecorder ( )
protectedvirtual

Creates the simulation recorder.

Author
dcofer
Date
3/28/2011
Returns
Pointer to the SimulationRecorder.

Implements AnimatSim::Simulator.

Definition at line 56 of file RbSimulator.cpp.

void RoboticsAnimatSim::RbSimulator::Initialize ( int  argc,
const char **  argv 
)
virtual

Initializes this object.

Author
dcofer
Date
3/28/2011

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.

Parameters
argcThe argc parameter from the command line.
argvThe argv parameter from the command line.

Implements AnimatSim::Simulator.

Definition at line 140 of file RbSimulator.cpp.

References AnimatSim::Simulator::InitializeStructures(), AnimatSim::Simulator::m_lpSimRecorder, AnimatSim::Simulator::m_oDataChartMgr, and AnimatSim::Simulator::m_oExternalStimuliMgr.

+ Here is the call graph for this function:

bool RoboticsAnimatSim::RbSimulator::InSimulation ( )
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.

Author
dcofer
Date
5/15/2014
Returns
True if running in simulation, false if running on real hardware.

Reimplemented from AnimatSim::Simulator.

Definition at line 51 of file RbSimulator.cpp.

bool RoboticsAnimatSim::RbSimulator::PauseSimulation ( )
virtual

Pauses the simulation.

Author
dcofer
Date
3/28/2011
Returns
true if it succeeds, false if it fails.

Implements AnimatSim::Simulator.

Definition at line 234 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bPaused, and AnimatSim::Simulator::SimPausing().

+ Here is the call graph for this function:

void RoboticsAnimatSim::RbSimulator::Reset ( )
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

Author
dcofer
Date
3/28/2011

Reimplemented from AnimatSim::Simulator.

Definition at line 61 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_lpAnimatClassFactory.

Referenced by SimulateEnd().

+ Here is the caller graph for this function:

void RoboticsAnimatSim::RbSimulator::ResetSimulation ( )
virtual

Resets the the simulation to its orginal settings at time 0.

Author
dcofer
Date
3/28/2011

Reimplemented from AnimatSim::Simulator.

Definition at line 69 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bSimRunning.

void RoboticsAnimatSim::RbSimulator::ShutdownSimulation ( )
virtual

Shuts down the simulation.

Author
dcofer
Date
3/28/2011

Implements AnimatSim::Simulator.

Definition at line 228 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bForceSimulationStop, and AnimatSim::Simulator::SimStopping().

Referenced by StepSimulation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RoboticsAnimatSim::RbSimulator::SimulateEnd ( )
protectedvirtual

Called at the end of the Simulate method.

Author
dcofer
Date
7/5/2011

Reimplemented from AnimatSim::Simulator.

Definition at line 269 of file RbSimulator.cpp.

References Reset().

+ Here is the call graph for this function:

virtual void RoboticsAnimatSim::RbSimulator::SnapshotStopFrame ( )
inlineprotectedvirtual

Takes a snapshot of the current frame.

Author
dcofer
Date
3/28/2011

Implements AnimatSim::Simulator.

Definition at line 30 of file RbSimulator.h.

bool RoboticsAnimatSim::RbSimulator::StartSimulation ( )
virtual

Starts the simulation.

Author
dcofer
Date
3/28/2011
Returns
true if it succeeds, false if it fails.

Implements AnimatSim::Simulator.

Definition at line 241 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bPaused, AnimatSim::Simulator::m_bSimRunning, AnimatSim::Simulator::m_lStartSimTick, and AnimatSim::Simulator::SimStarting().

+ Here is the call graph for this function:

void RoboticsAnimatSim::RbSimulator::StepSimulation ( )
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.

Author
dcofer
Date
3/28/2011

Reimplemented from AnimatSim::Simulator.

Definition at line 151 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bPaused, AnimatSim::Simulator::m_fltPhysicsStepTime, AnimatSim::Simulator::m_lTimeSlice, and ShutdownSimulation().

+ Here is the call graph for this function:

void RoboticsAnimatSim::RbSimulator::StopSimulation ( )
virtual

Stops the simulation and resets it.

Author
dcofer
Date
3/28/2011

Implements AnimatSim::Simulator.

Definition at line 261 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bPaused, AnimatSim::Simulator::m_bSimRunning, AnimatSim::Simulator::SimStopping(), and ToggleSimulation().

+ Here is the call graph for this function:

void RoboticsAnimatSim::RbSimulator::ToggleSimulation ( )
virtual

Toggles the simulation between running and paused.

Author
dcofer
Date
3/28/2011

Implements AnimatSim::Simulator.

Definition at line 251 of file RbSimulator.cpp.

References AnimatSim::Simulator::m_bPaused, AnimatSim::Simulator::SimPausing(), and AnimatSim::Simulator::SimStarting().

Referenced by StopSimulation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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