8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
14 #include "IPhysicsMovableItem.h"
15 #include "IPhysicsBody.h"
17 #include "MovableItem.h"
73 {
Std_TraceMsg(0,
"Caught Error in desctructor of NervousSystem\r\n",
"", -1,
false,
true);}
91 THROW_ERROR(Al_Err_lNeuralModuleNotDefined, Al_Err_strNeuralModuleNotDefined);
169 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
173 lpModule = oPos->second;
175 THROW_PARAM_ERROR(Al_Err_lModuleNameNotFound, Al_Err_strModuleNameNotFound,
"ModuleName", strModuleName);
184 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
187 lpModule = oPos->second;
188 lpModule->
Kill(bState);
195 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
198 lpModule = oPos->second;
217 THROW_PARAM_ERROR(Al_Err_lStructureNotDefined, Al_Err_strStructureNotDefined,
"Link: ",
m_strID);
220 THROW_PARAM_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Link: ",
m_strID);
228 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
233 lpModule = oPos->second;
238 void NervousSystem::MinTimeStep(
float &fltMin)
241 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
245 lpModule = oPos->second;
258 void NervousSystem::StepSim()
261 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
265 lpModule = oPos->second;
272 void NervousSystem::StepAdapters()
275 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
279 lpModule = oPos->second;
284 lpModule->ResetStepCounter();
292 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
297 lpModule = oPos->second;
308 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
312 lpModule = oPos->second;
321 CStdPtrMap<std::string, NeuralModule>::iterator oPos;
325 lpModule = oPos->second;
331 void NervousSystem::Load(
CStdXml &oXml)
338 for(
int iIndex=0; iIndex<iCount; iIndex++)
368 std::string strModuleName, strModuleFileName, strModuleType;
384 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"NeuralModule");
390 {
delete lpFactory; lpFactory = NULL;}
395 m_lpSim->AddNeuralModuleFactory(strModuleName, lpModule);
398 lpModule->
Load(oXml);
406 if(lpFactory)
delete lpFactory;
407 if(lpModule)
delete lpModule;
413 if(lpFactory)
delete lpFactory;
414 if(lpModule)
delete lpModule;
415 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
Base class file for all Animat simulation objects.
Declares the nervous system class.
Declares the simulation recorder class.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
Simulates the entire environment.
virtual void LoadKeyFrameSnapshot(byte *aryBytes, long &lIndex)
Loads a key frame snapshot.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
Root namespace for the base simulation library for AnimatLab.
virtual float TimeStep()
Gets the time step for this moudle in time units.
virtual void SaveKeyFrameSnapshot(byte *aryBytes, long &lIndex)
Saves a key frame snapshot.
Declares the body part class.
virtual void Kill(bool bState=true)
Kills.
std::string m_strError
The error message.
virtual void Initialize()
Initializes this object.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
Information about the standard error.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
virtual void Initialize()
Initializes this object.
virtual bool NeedToStep(bool bIncrement)
Tells whether this NeuralModule needs to call StepSimulation.
virtual void Initialize()
Initializes this object.
virtual void RemoveNeuralModule(std::string strID)
Removes the neural module based on its ID.
Declares the link base class.
Declares the key frame class.
NervousSystem()
Default constructor.
Declares the joint class.
Declares the organism class.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
std::string m_strID
The unique Id for this object.
static IStdClassFactory * LoadClassFactory(std::string strModuleName, bool bThrowError=true)
Loads the class factory specified in the DLL module name.
Declares the activated item class.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual std::string ModuleName()=0
Gets the module name.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
Declares a light manager object.
void AddNeuralModule(NeuralModule *lpModule)
Adds a neural module to the nervous system.
Declares the bounding box class.
virtual void StepSimulation()
Step the simulation for this object.
Organism * m_lpOrganism
The pointer to this node's organism.
A standard xml manipulation class.
A "static" structure in the simulation.
virtual void SaveKeyFrameSnapshot(byte *aryBytes, long &lIndex)
Saves a key frame snapshot.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
NeuralModule * LoadNeuralModule(CStdXml &oXml)
Creates and loads a neural module.
virtual CStdSerialize * CreateObject(std::string strClassType, std::string strObjectType, bool bThrowError=true)=0
Creates an object of the specified class and object types.
virtual void LoadKeyFrameSnapshot(byte *aryBytes, long &lIndex)
Loads a key frame snapshot.
virtual long CalculateSnapshotByteSize()
Calculates the snapshot byte size.
virtual void Kill(bool bState=true)
Kills.
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
virtual void ResetSimulation()
Resets the simulation back to time 0.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual ~NervousSystem()
Destructor.
virtual void StepAdapters()
Step adapters.
virtual int NumberOfChildren()
Gets the number of children of the current element.
A dynamic organism that is controlled by a neural network.
Base class for body parts and neural network nodes.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual void StepSimulation()
Step the simulation for this object.
Declares the data chart manager class.
Declares the rigid body class.
CStdPtrMap< std::string, NeuralModule > m_aryNeuralModules
The array of neural modules used within this nervous system.
virtual bool IntoChildElement(std::string strElementName, bool bThrowError=true)
Goes into the child element with the specified name.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
Declares the structure class.
Declares the odor type class.
virtual long CalculateSnapshotByteSize()
Calculates the snapshot byte size.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
virtual NeuralModule * FindNeuralModule(std::string strModuleName, bool bThrowError=true)
Searches for a neural module with a matching module name.
Declares the simulator class.
Declares the neural module class.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
Declares the activated item manager class.
Declares the external stimuli manager class.
Declares the receptive field class.