AnimatLab
2
Test
|
Contact adapter that processes ReceptiveField contacts. More...
#include <ContactAdapter.h>
Public Member Functions | |
ContactAdapter () | |
Default constructor. More... | |
virtual | ~ContactAdapter () |
Destructor. More... | |
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 void | Initialize () |
Initializes this object. More... | |
virtual void | Load (CStdXml &oXml) |
virtual bool | RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true) |
Removes a child item from this parent. More... | |
virtual std::string | SourceBodyID () |
Gets the GUID ID of the source RigidBody. More... | |
virtual void | SourceBodyID (std::string strID) |
Sets the GUID ID of the source RigidBody. More... | |
virtual std::string | SourceModule () |
Gets the name of the source NeuralModule. More... | |
virtual void | StepSimulation () |
Step the simulation for this object. More... | |
virtual std::string | TargetModule () |
Gets the name of the target NeuralModule. More... | |
virtual void | TargetModule (std::string strModule) |
Sets the target NeuralModule name. More... | |
Public Member Functions inherited from AnimatSim::Adapters::Adapter | |
Adapter () | |
Default constructor. More... | |
virtual | ~Adapter () |
Destructor. More... | |
virtual void | AddExternalNodeInput (int iTargetDataType, float fltInput) |
Adds an external node input. More... | |
virtual bool | ConnectedToPhysics () |
Returns whether or not this adpater is connected to a physics object or not. More... | |
virtual float | DelayBufferInterval () |
Returns the time interval used for the delay buffer if this adapter is set to use one. More... | |
virtual void | DelayBufferInterval (float fltVal) |
Sets the time interval used for the delay buffer if this adapter is set to use one. More... | |
virtual eDelayBufferMode | DelayBufferMode () |
Returns the mode for the delay buffer. More... | |
virtual void | DelayBufferMode (eDelayBufferMode eMode) |
Sets the target data type. More... | |
virtual void | DetachAdaptersFromSimulation () |
virtual float * | GetDataPointer (const std::string &strDataType) |
Returns a float pointer to a data item of interest in this object. More... | |
virtual Gain * | GetGain () |
Gets the poitner to the gain function. More... | |
virtual float | InitIODisableDuration () |
Gets the duration for how long this adapter is disabled at the start of the simulation. More... | |
virtual void | InitIODisableDuration (float fltVal) |
Sets the duration for how long this adapter is disabled at the start of the simulation. More... | |
virtual void | QueryProperties (CStdPtrArray< TypeProperty > &aryProperties) |
Queries this object for a list of properties that can be changed using SetData. More... | |
virtual void | ResetSimulation () |
Resets the simulation back to time 0. More... | |
virtual float | RobotIOScale () |
Gets the scale value used for calculated values for this adapter during simulation mode only. More... | |
virtual void | RobotIOScale (float fltVal) |
Sets the scale value used for calculated values for this adapter during simulation mode only. More... | |
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 void | SetGain (Gain *lpGain) |
virtual std::string | SourceDataType () |
Gets the source data type. More... | |
virtual void | SourceDataType (std::string strType) |
Sets the source data type. More... | |
virtual std::string | SourceID () |
Gets the GUID ID of the source node where we will get the source data variable. More... | |
virtual void | SourceID (std::string strID) |
Sets the GUID ID of the Source node. More... | |
virtual void | SourceModule (std::string strName) |
Sets the Source NeuralModule name. More... | |
virtual Node * | SourceNode () |
Gets the source node. More... | |
virtual float | SynchUpdateInterval () |
This is how often we need to update this particular adapter. More... | |
virtual void | SynchUpdateInterval (float fltVal) |
Determines how often we need to update this particular adapter. More... | |
virtual float | SynchUpdateStartInterval () |
This is the interval that this adapter waits the first time before doing its update. More... | |
virtual void | SynchUpdateStartInterval (float fltVal) |
This is the interval that this adapter waits the first time before doing its update. More... | |
virtual bool | SynchWithRobot () |
Gets whether the m_bRobotAdpaterSynch flag applies to this adapter. More... | |
virtual void | SynchWithRobot (bool bVal) |
Determines whether the m_bRobotAdpaterSynch flag applies to this adapter. More... | |
virtual std::string | TargetDataType () |
Gets the target data type. More... | |
virtual void | TargetDataType (std::string strType) |
Sets the target data type. More... | |
virtual std::string | TargetID () |
Gets the GUID ID of the target node where we will add the transformed data variable. More... | |
virtual void | TargetID (std::string strID) |
Sets the GUID ID of the target node. More... | |
virtual Node * | TargetNode () |
Gets the target node. More... | |
virtual void | TimeStepModified () |
If the time step is modified then we need to recalculate the length of the delay buffer. More... | |
Public Member Functions inherited from AnimatSim::Node | |
Node () | |
Default constructor. More... | |
virtual | ~Node () |
Destructor. More... | |
virtual void | Copy (CStdSerialize *lpSource) |
virtual bool | Enabled () |
Tells whether this node is enabled. More... | |
virtual void | Enabled (bool bValue) |
Enables the node. More... | |
virtual int | GetTargetDataTypeIndex (const std::string &strDataType) |
Used to convert a string target data type into an integer index. More... | |
virtual void | Kill (bool bState=true) |
Kills. More... | |
virtual void | SetSystemPointers (Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify) |
Sets the system pointers. More... | |
virtual void | VerifySystemPointers () |
Verify that system pointers have been set correctly. 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 long | CalculateSnapshotByteSize () |
Calculates the snapshot byte size. 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 | Load (StdUtils::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 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 | Reset () |
Resets this object. More... | |
virtual void | RigidBodyAdded (std::string strID) |
virtual void | RigidBodyRemoved (std::string strID) |
virtual void | SaveKeyFrameSnapshot (byte *aryBytes, long &lIndex) |
Saves a key frame snapshot. More... | |
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 | SimPausing () |
Called just before the simulation pauses. More... | |
virtual void | SimStarting () |
Called just before the simulation starts. More... | |
virtual void | SimStopping () |
Called just before the simulation stops. 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 | VisualSelectionModeChanged (int iNewMode) |
Visual selection mode changed. More... | |
Static Public Member Functions | |
static ContactAdapter * | CastToDerived (AnimatBase *lpBase) |
Static Public Member Functions inherited from AnimatSim::Adapters::Adapter | |
static Adapter * | CastToDerived (AnimatBase *lpBase) |
Static Public Member Functions inherited from AnimatSim::Node | |
static Node * | CastToDerived (AnimatBase *lpBase) |
Protected Member Functions | |
virtual void | AddFieldPair (std::string strXml, bool bDoNotInit) |
virtual int | FindFieldPairListPos (std::string strID, bool bThrowError=true) |
ReceptiveFieldPair * | LoadFieldPair (CStdXml &oXml) |
Loads a ReceptiveFieldPair object. More... | |
virtual void | RemoveFieldPair (std::string strID, bool bThrowError=true) |
Protected Member Functions inherited from AnimatSim::Adapters::Adapter | |
virtual void | AddGain (std::string strXml) |
Creates and adds a gain object. More... | |
virtual void | ApplyExternalNodeInput (int iTargetDataType, float fltNextVal) |
virtual bool | NeedsRobotSynch () |
virtual void | SetDelayBufferSize () |
virtual void | SetDestinationID (std::string strXml) |
virtual void | SetOriginID (std::string strXml) |
Protected Member Functions inherited from AnimatSim::Node | |
virtual void | UpdateData () |
Updates any reporting data for this time step. More... | |
Protected Attributes | |
CStdPtrArray< ReceptiveFieldPair > | m_aryFieldPairs |
The array of ReceptiveFieldPair objects. | |
std::string | m_strSourceBodyID |
GUID ID of the source RigidBody. | |
std::string | m_strTargetModule |
The name of the target NeuralModule. | |
Protected Attributes inherited from AnimatSim::Adapters::Adapter | |
CStdCircularArray< float > | m_aryDelayBuffer |
bool | m_bConnectedToPhysics |
bool | m_bSynchWithRobot |
eDelayBufferMode | m_eDelayBufferMode |
float | m_fltCalculatedVal |
This is the value that will was calculated for this adpater. If you are using a delay buffer this may be different than m_fltNextVal. | |
float | m_fltDelayBufferInterval |
float | m_fltInitIODisableDuration |
float | m_fltNextVal |
This is the value that will be passed into the adpters target. | |
float | m_fltRobotIOScale |
float | m_fltSynchUpdateInterval |
This is how often we need to update this particular adapter. | |
float | m_fltSynchUpdateStartInterval |
float | m_fltUpdatedValue |
Set to 1 each time the adapter was updated and 0 otherwise. Use to chart when the adpater was updated. | |
int | m_iSynchCount |
Keeps track of the last time we did a synch for the robot. | |
int | m_iSynchTarget |
The target count for synching. | |
int | m_iSynchUpdateInterval |
The number of ticks between each call to update for this adapter till the next update time. | |
int | m_iSynchUpdateStartInterval |
The number of ticks between the first call to update for this adapter till the next update time. | |
int | m_iTargetDataType |
The m_strTargetDataType string is converted to an integer for use within the simulation loop to maximixe speed. | |
Gain * | m_lpGain |
Pointer to the Gain that will be used to convert the source value into the target value. | |
float * | m_lpSourceData |
Pointer to the source data varaible. | |
Node * | m_lpSourceNode |
Pointer to the source node. | |
Node * | m_lpTargetNode |
Pointer to the target node. | |
std::string | m_strSourceDataType |
DateType of the source variable that will be converted. This is retrieved using the GetDataPointer method. | |
std::string | m_strSourceID |
GUID ID of the source node. | |
std::string | m_strSourceModule |
Name of the source NeuralModule. | |
std::string | m_strTargetDataType |
std::string | m_strTargetID |
GUID ID of the target node. | |
std::string | m_strTargetModule |
Name of the target NeuralModule. | |
Protected Attributes inherited from AnimatSim::Node | |
bool | m_bInitEnabled |
Keeps track of the enabled state at sim startup. | |
float | m_fltEnabled |
This is used for reporting the enabled state in a GetDataPointer call. | |
Organism * | m_lpOrganism |
The pointer to this node's organism. | |
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.. | |
Contact adapter that processes ReceptiveField contacts.
There is only a single ContactAdapter that processes all ReceptiveFieldPairs for a single RigidBody object. It has a list of all ReceptiveFields for that body and loops through them to determine the stimulus that needs to be applied to the associated neurons.
Definition at line 23 of file ContactAdapter.h.
AnimatSim::Adapters::ContactAdapter::ContactAdapter | ( | ) |
|
virtual |
Destructor.
Definition at line 64 of file ContactAdapter.cpp.
References m_aryFieldPairs, and StdUtils::Std_TraceMsg().
|
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 175 of file ContactAdapter.cpp.
References StdUtils::Std_CheckString().
|
virtual |
Initializes this object.
After an object is loaded in it must be initialized before it can be used. This allows the object to retrieve any pointers or setup memory that it will need during execution. Each object is responsible for initializing any of its child objects, so you simply need to call this method on the containing class to init all child objects. It also calls VerifySystemPointers to make sure that the system pointers have been setup correctly.
Reimplemented from AnimatSim::Adapters::Adapter.
Definition at line 155 of file ContactAdapter.cpp.
References AnimatSim::Simulator::FindByID(), AnimatSim::Environment::ReceptiveFieldPair::Initialize(), AnimatSim::AnimatBase::Initialize(), m_aryFieldPairs, AnimatSim::AnimatBase::m_lpSim, AnimatSim::Adapters::Adapter::m_lpSourceNode, AnimatSim::AnimatBase::m_lpStructure, and m_strSourceBodyID.
|
protected |
Loads a ReceptiveFieldPair object.
[in,out] | oXml | The xml that defines the ReceptiveFieldPair. |
Throws | an exception if there is a problem creating or loading the ReceptiveFieldPair. |
Definition at line 254 of file ContactAdapter.cpp.
References m_aryFieldPairs, AnimatSim::AnimatBase::m_lpNode, AnimatSim::AnimatBase::m_lpSim, AnimatSim::AnimatBase::m_lpStructure, and AnimatSim::AnimatBase::SetSystemPointers().
|
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 192 of file ContactAdapter.cpp.
References StdUtils::Std_CheckString().
|
virtual |
Gets the GUID ID of the source RigidBody.
Definition at line 83 of file ContactAdapter.cpp.
References m_strSourceBodyID.
|
virtual |
Sets the GUID ID of the source RigidBody.
strID | GUID ID. |
Definition at line 93 of file ContactAdapter.cpp.
References m_strSourceBodyID, and StdUtils::Std_IsBlank().
|
virtual |
Gets the name of the source NeuralModule.
Reimplemented from AnimatSim::Adapters::Adapter.
Definition at line 100 of file ContactAdapter.cpp.
|
virtual |
Step the simulation for this object.
This is called on an object each time it is stepped in the simulation. this is where its simulation code is processed. However, StepSimulation is not necessarily called every single time that the simulation as a whole is stepped. A good example of this is that neural modules can have different integration time steps. So a firing rate module may have a DT of 0.5 ms, while an integrate and fire model may have one of 0.1 ms. So the firing rate module would only get its StepSimulation method called every 5th time that the other module was called. This is all handed in the StepSimulation method of the Simulator and NervousSystem.
Reimplemented from AnimatSim::Adapters::Adapter.
Definition at line 209 of file ContactAdapter.cpp.
References m_aryFieldPairs.
|
virtual |
Gets the name of the target NeuralModule.
Reimplemented from AnimatSim::Adapters::Adapter.
Definition at line 103 of file ContactAdapter.cpp.
References m_strTargetModule.
|
virtual |
Sets the target NeuralModule name.
strModule | The new Target Neuralmodule. |
Reimplemented from AnimatSim::Adapters::Adapter.
Definition at line 114 of file ContactAdapter.cpp.
References m_strTargetModule, and StdUtils::Std_IsBlank().