8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
14 #include "IPhysicsMovableItem.h"
15 #include "IPhysicsBody.h"
17 #include "MovableItem.h"
97 {
Std_TraceMsg(0,
"Caught Error in desctructor of NeuralModule\r\n",
"", -1,
false,
true);}
176 if(iVal == 0) iVal = 1;
211 float fltMin =
m_lpSim->MinTimeStep();
214 int iDiv = (int) ((fltVal / fltMin) + 0.5f);
236 for(
int iIndex=0; iIndex<iCount; iIndex++)
261 void NeuralModule::ResetStepCounter()
266 int NeuralModule::FindAdapterListIndex(CStdArray<Adapter *> aryAdapters, std::string strID,
bool bThrowError)
268 int iCount = aryAdapters.GetSize();
269 for(
int iIdx=0; iIdx<iCount; iIdx++)
270 if(aryAdapters[iIdx]->
ID() == strID)
274 THROW_PARAM_ERROR(Al_Err_lAdapterIDNotFound, Al_Err_strAdapterIDNotFound,
"ID", strID);
314 THROW_ERROR(Al_Err_lSynapseToAddNull, Al_Err_strSynapseToAddNull);
326 void NeuralModule::AddExternalSynapse(std::string strXml,
bool bDoNotInit)
369 for(
int iIndex=0; iIndex<iCount; iIndex++)
374 THROW_TEXT_ERROR(Al_Err_lSynapseNotFound, Al_Err_strSynapseNotFound,
"ID");
398 for(
int iIdx=0; iIdx<iCount; iIdx++)
421 std::string strModuleFilename, strType;
433 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Synapse");
436 lpSynapse->
Load(oXml);
437 AddExternalSynapse(lpSynapse);
443 if(lpSynapse)
delete lpSynapse;
449 if(lpSynapse)
delete lpSynapse;
450 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
469 THROW_PARAM_ERROR(Al_Err_lStructureNotDefined, Al_Err_strStructureNotDefined,
"ConstraintLimit: ",
m_strName);
472 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Organism");
480 if(strType ==
"TIMESTEP")
489 for(
int iIdx=0; iIdx<iCount; iIdx++)
496 for(
int iIdx=0; iIdx<iCount; iIdx++)
CStdPtrArray< AnimatSim::Link > m_aryExternalSynapses
An array of external synapses connected to nodes within this module.
virtual void RemoveExternalSynapse(std::string strID, bool bThrowError=true)
Removes the synapse by the GUID ID.
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
virtual IStdClassFactory * ClassFactory()
Gets the class factory.
CStdArray< Adapter * > m_arySourceAdapters
An array of source adapters for this module.
Base class file for all Animat simulation objects.
virtual short TimeStepInterval()
Gets the time step interval.
Declares the nervous system class.
virtual void RemoveSourceAdapter(Adapter *lpAdapter)
Removes a source adapter.
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.
Organism * GetOrganism()
Gets the organism.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
Root namespace for the base simulation library for AnimatLab.
Simulator * GetSimulator()
Gets the simulator.
virtual float TimeStep()
Gets the time step for this moudle in time units.
Declares the body part class.
IStdClassFactory * m_lpClassFactory
The pointer to the class factory for this module.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
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 std::string ID()
Gets the unique GUID ID of this object.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
virtual int FindExternalSynapseListPos(std::string strID, bool bThrowError=true)
Searches for a synapse with the specified ID and returns its position in the list.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
virtual bool NeedToStep(bool bIncrement)
Tells whether this NeuralModule needs to call StepSimulation.
virtual void Initialize()
Initializes this object.
Declares the link base class.
Declares the key frame class.
Declares the joint class.
virtual void AttachSourceAdapter(Adapter *lpAdapter)
Attaches a source adapter.
Declares the organism class.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
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 Std_Trim(std::string strVal)
Trims a string.
Declares the activated item class.
virtual void AttachTargetAdapter(Adapter *lpAdapter)
Attaches a target adapter.
virtual float TimeStep()
Gets the smallest integration time step used within the simulation.
short m_iTimeStepCount
Count variable that keeps track of how many slices have occured since the last StepSimulation.
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Declares a light manager object.
Base class for all link type objects. This is typically used for synapses.
virtual AnimatSim::Link * LoadExternalSynapse(CStdXml &oXml)
Loads an external synapse.
Declares the bounding box class.
CStdArray< Adapter * > m_aryTargetAdapters
An array of target adapters for this module.
Declares the gain base class.
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.
virtual ~NeuralModule()
Destructor.
A standard xml manipulation class.
A "static" structure in the simulation.
Organism * m_lpOrganism
The pointer to the organism.
virtual void LoadExternalSynapses(CStdXml &oXml)
Loads external synapses.
virtual void RemoveTargetAdapter(Adapter *lpAdapter)
Removes a target adapter.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
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 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.
short m_iTargetAdapterCount
Number of target adapters.
Declares the rigid body class.
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.
NeuralModule()
Default constructor.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
Declares the structure class.
Declares the odor type class.
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.
float m_fltTimeStep
The DT time step for this neural module in seconds.
Declares the simulator class.
Declares the neural module class.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
Declares the activated item manager class.
Declares the external stimuli manager class.
short m_iTimeStepInterval
Declares the receptive field class.
std::string m_strName
The name for this object.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.