AnimatLab  2
Test
AnimatCarlSim::CsAdapter Class Reference

Current stimulus for neural items. More...

#include <CsAdapter.h>

+ Inheritance diagram for AnimatCarlSim::CsAdapter:
+ Collaboration diagram for AnimatCarlSim::CsAdapter:

Public Member Functions

 CsAdapter ()
 Default constructor. More...
 
virtual ~CsAdapter ()
 Destructor. More...
 
virtual void CellsToStim (std::string strXml)
 
virtual void Coverage (std::string strType)
 
virtual void Initialize ()
 Initializes this object. More...
 
virtual void Load (CStdXml &oXml)
 
virtual void QueryProperties (CStdPtrArray< TypeProperty > &aryProperties)
 
virtual void ResetSimulation ()
 Resets the simulation back to time 0. 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 bool StimWholePopulation ()
 
virtual void StimWholePopulation (bool bVal)
 
- 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 GainGetGain ()
 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 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 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 std::string SourceModule ()
 Gets the name of the source NeuralModule. More...
 
virtual void SourceModule (std::string strName)
 Sets the Source NeuralModule name. More...
 
virtual NodeSourceNode ()
 Gets the source node. More...
 
virtual void StepSimulation ()
 Step the simulation for this object. 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 std::string TargetModule ()
 Gets the name of the target NeuralModule. More...
 
virtual void TargetModule (std::string strName)
 Sets the target NeuralModule name. More...
 
virtual NodeTargetNode ()
 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 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 AfterResetSimulation ()
 Called after a simulation reset for some objects. More...
 
virtual long CalculateSnapshotByteSize ()
 Calculates the snapshot byte size. 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 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 bool RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true)
 Removes a child item from this parent. 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 CsAdapterCastToDerived (AnimatBase *lpBase)
 
- Static Public Member Functions inherited from AnimatSim::Adapters::Adapter
static AdapterCastToDerived (AnimatBase *lpBase)
 
- Static Public Member Functions inherited from AnimatSim::Node
static NodeCastToDerived (AnimatBase *lpBase)
 

Protected Member Functions

virtual void ApplyExternalNodeInput (int iTargetDataType, float fltRate)
 
virtual void LoadCellsToStim (CStdXml &oXml)
 
virtual bool RateChanged (float fltRate)
 
- Protected Member Functions inherited from AnimatSim::Adapters::Adapter
virtual void AddGain (std::string strXml)
 Creates and adds a gain object. More...
 
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

CStdMap< int, int > m_aryCellsToStim
 An array of neuron indices for individual neurons we want to stimulate.
 
bool m_bStimWholePopulation
 
float m_fltPrevAppliedRate
 Last applied rate.
 
CsSpikeGeneratorGroupm_lpSpikeGen
 The spike generator this adapter is stimulating.
 
- 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.
 
Nodem_lpSourceNode
 Pointer to the source node.
 
Nodem_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::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..
 

Detailed Description

Current stimulus for neural items.

Author
dcofer
Date
3/16/2011

Definition at line 20 of file CsAdapter.h.

Constructor & Destructor Documentation

AnimatCarlSim::CsAdapter::CsAdapter ( )

Default constructor.

Author
dcofer
Date
3/16/2011

Definition at line 23 of file CsAdapter.cpp.

References m_fltPrevAppliedRate, and m_lpSpikeGen.

AnimatCarlSim::CsAdapter::~CsAdapter ( )
virtual

Destructor.

Author
dcofer
Date
3/16/2011

Definition at line 36 of file CsAdapter.cpp.

References m_lpSpikeGen, and StdUtils::Std_TraceMsg().

+ Here is the call graph for this function:

Member Function Documentation

void AnimatCarlSim::CsAdapter::Initialize ( )
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.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::Adapters::Adapter.

Definition at line 72 of file CsAdapter.cpp.

References m_lpSpikeGen, AnimatSim::Adapters::Adapter::m_lpTargetNode, and AnimatSim::Adapters::Adapter::m_strTargetID.

void AnimatCarlSim::CsAdapter::ResetSimulation ( )
virtual

Resets the simulation back to time 0.

This method calls the ResetSimulation method on all subitems in order to reset the simulation back to the beginning.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::Adapters::Adapter.

Definition at line 127 of file CsAdapter.cpp.

References m_fltPrevAppliedRate.

bool AnimatCarlSim::CsAdapter::SetData ( const std::string &  strDataType,
const std::string &  strValue,
bool  bThrowError = true 
)
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.

Author
dcofer
Date
2/22/2011
Parameters
strDataTypestring name of the data type to set.
strValueThe 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.
bThrowErrortrue to throw error if there is a problem. If false then it will not return an error, just return false.
Returns
true if it succeeds, false if it fails.

Reimplemented from AnimatSim::Adapters::Adapter.

Definition at line 133 of file CsAdapter.cpp.

References StdUtils::Std_CheckString().

+ Here is the call graph for this function:


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