AnimatLab  2
Test
AnimatSim::Adapters::Adapter Class Reference

Adapter. More...

#include <Adapter.h>

+ Inheritance diagram for AnimatSim::Adapters::Adapter:
+ Collaboration diagram for AnimatSim::Adapters::Adapter:

Public Member Functions

 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 void Initialize ()
 Initializes this object. 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 Load (CStdXml &oXml)
 
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 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 AdapterCastToDerived (AnimatBase *lpBase)
 
- Static Public Member Functions inherited from AnimatSim::Node
static NodeCastToDerived (AnimatBase *lpBase)
 

Protected Member Functions

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

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

Adapter.

Adapters are generalized mechanism that allows items in one module to talk to items in another. For example, It allows a neuron in a firing rate neural module to inject current into an integrate and fire neuron, or to talk to the physics engine.

Author
dcofer
Date
2/28/2011

Definition at line 39 of file Adapter.h.

Constructor & Destructor Documentation

AnimatSim::Adapters::Adapter::~Adapter ( )
virtual

Destructor.

Author
dcofer
Date
3/18/2011

Definition at line 82 of file Adapter.cpp.

References m_lpGain, m_lpSourceData, m_lpSourceNode, m_lpTargetNode, and StdUtils::Std_TraceMsg().

+ Here is the call graph for this function:

Member Function Documentation

void AnimatSim::Adapters::Adapter::AddExternalNodeInput ( int  iTargetDataType,
float  fltInput 
)
virtual

Adds an external node input.

This is used by the adapter to add a new external value to this node. It is up to the node to interpret what that value means. For example, if it is a neuron then it can interpret it to be a current. This value is added to the current total so that multiple adapters can call this in a given time step. It is cleared out to zero at the beginning of the time step. You can now also specify which data you are adding to for this method call. This allows adapters to be setup to change multiple different variables in the system.

Author
dcofer
Date
6/16/2014
Parameters
iTargetDataTypeThe index of the target data type we are adding to.
fltInputThe new input.

Implements AnimatSim::Node.

Definition at line 539 of file Adapter.cpp.

void AnimatSim::Adapters::Adapter::AddGain ( std::string  strXml)
protectedvirtual

Creates and adds a gain object.

Author
dcofer
Date
3/2/2011
Parameters
strXmlThe xml data packet for loading the gain.

Definition at line 570 of file Adapter.cpp.

References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), AnimatSim::Gains::LoadGain(), and AnimatSim::AnimatBase::m_lpSim.

Referenced by SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool AnimatSim::Adapters::Adapter::ConnectedToPhysics ( )
virtual

Returns whether or not this adpater is connected to a physics object or not.

Author
dcofer
Date
5/13/2014
Returns
Pointer to the gain.

Definition at line 295 of file Adapter.cpp.

References m_bConnectedToPhysics.

float AnimatSim::Adapters::Adapter::DelayBufferInterval ( )
virtual

Returns the time interval used for the delay buffer if this adapter is set to use one.

Author
dcofer
Date
5/15/2014
Returns
interval.

Definition at line 336 of file Adapter.cpp.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::DelayBufferInterval ( float  fltVal)
virtual

Sets the time interval used for the delay buffer if this adapter is set to use one.

Author
dcofer
Date
3/18/2011
Parameters
fltValnew time step.

Definition at line 346 of file Adapter.cpp.

References StdUtils::Std_IsAboveMin().

+ Here is the call graph for this function:

eDelayBufferMode AnimatSim::Adapters::Adapter::DelayBufferMode ( )
virtual

Returns the mode for the delay buffer.

This is what determines whether a delay buffer is used at all or only during the simulation. See eDelayBufferMode.

Author
dcofer
Date
5/15/2014
Returns
mode.

Definition at line 307 of file Adapter.cpp.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::DelayBufferMode ( eDelayBufferMode  eMode)
virtual

Sets the target data type.

This is what determines whether a delay buffer is used at all or only during the simulation. See eDelayBufferMode.

Author
dcofer
Date
3/18/2011
Parameters
eModenew mode.

Definition at line 322 of file Adapter.cpp.

float * AnimatSim::Adapters::Adapter::GetDataPointer ( const std::string &  strDataType)
virtual

Returns a float pointer to a data item of interest in this object.

This is a generic method used to get a pointer to data variable of interest. It is used by a variety of systems in the simulation. The most prominent are the data charting and stimulus classes. Within this method we associate a variable with a string name. By passing in the name of the data type we are interested in we can recieve back a float pointer to that data type. We can use that to read or set the data item in other classes. For example, the data charting system gets the pointer and then each time it needs to log a data point it reads the value into an array.

Author
dcofer
Date
2/22/2011
Parameters
strDataTypename of the data item for which we are looking.
Returns
float pointer of the data item. If not found then it throws an exception.
Exceptions
IfDataType is not found.

Reimplemented from AnimatSim::AnimatBase.

Definition at line 544 of file Adapter.cpp.

References AnimatSim::AnimatBase::GetDataPointer(), m_fltCalculatedVal, AnimatSim::Node::m_fltEnabled, m_fltNextVal, m_fltUpdatedValue, and StdUtils::Std_CheckString().

+ Here is the call graph for this function:

Gain * AnimatSim::Adapters::Adapter::GetGain ( )
virtual

Gets the poitner to the gain function.

Author
dcofer
Date
3/18/2011
Returns
Pointer to the gain.

Definition at line 273 of file Adapter.cpp.

References m_lpGain.

void AnimatSim::Adapters::Adapter::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::AnimatBase.

Reimplemented in AnimatSim::Adapters::PropertyControlAdapter, AnimatSim::Adapters::ContactAdapter, and AnimatCarlSim::CsAdapter.

Definition at line 786 of file Adapter.cpp.

References AnimatSim::Simulator::FindByID(), AnimatSim::AnimatBase::GetDataPointer(), AnimatSim::Node::GetTargetDataTypeIndex(), AnimatSim::AnimatBase::ID(), AnimatSim::AnimatBase::Initialize(), m_bConnectedToPhysics, m_fltSynchUpdateInterval, m_fltSynchUpdateStartInterval, m_iTargetDataType, AnimatSim::AnimatBase::m_lpSim, m_lpSourceData, m_lpSourceNode, AnimatSim::AnimatBase::m_lpStructure, m_lpTargetNode, AnimatSim::AnimatBase::m_strID, m_strSourceDataType, m_strSourceID, m_strTargetDataType, m_strTargetID, SynchUpdateInterval(), and SynchUpdateStartInterval().

+ Here is the call graph for this function:

float AnimatSim::Adapters::Adapter::InitIODisableDuration ( )
virtual

Gets the duration for how long this adapter is disabled at the start of the simulation.

It is sometimes useful to disable IO operations briefly at the start of the simulation to give neural systems a chance to stabilize. This param defines how long it should disable IO for this adapter at the start of the sim..

Author
dcofer
Date
6/11/2014
Returns
duration for which IO is disabled at the start of the simulation.

Definition at line 508 of file Adapter.cpp.

References m_fltInitIODisableDuration.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::InitIODisableDuration ( float  fltVal)
virtual

Sets the duration for how long this adapter is disabled at the start of the simulation.

It is sometimes useful to disable IO operations briefly at the start of the simulation to give neural systems a chance to stabilize. This param defines how long it should disable IO for this adapter at the start of the sim..

Author
dcofer
Date
6/11/2014
Parameters
fltValduration for which IO is disabled at the start of the simulation.

Definition at line 524 of file Adapter.cpp.

References m_fltInitIODisableDuration, and StdUtils::Std_IsAboveMin().

+ Here is the call graph for this function:

void AnimatSim::Adapters::Adapter::QueryProperties ( CStdPtrArray< TypeProperty > &  aryProperties)
virtual

Queries this object for a list of properties that can be changed using SetData.

The method provides a list of the properties that can be set using the SetData method. It gives the property name and the type of data that should be passed to it. Valid date types are Boolean, Float, Integer, and Xml.

Author
dcofer
Date
2/22/2011
Parameters
aryNamesArray list of the property names.
strTypesArray list of the type that is associated with the cooresponding name in the list.
Returns
Nothing.

Reimplemented from AnimatSim::Node.

Reimplemented in AnimatSim::Adapters::PropertyControlAdapter.

Definition at line 700 of file Adapter.cpp.

References AnimatSim::Node::QueryProperties().

Referenced by AnimatSim::Adapters::PropertyControlAdapter::QueryProperties().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::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::Node.

Reimplemented in AnimatSim::Adapters::PropertyControlAdapter, and AnimatCarlSim::CsAdapter.

Definition at line 753 of file Adapter.cpp.

References m_aryDelayBuffer, m_fltCalculatedVal, m_fltNextVal, m_fltUpdatedValue, m_iSynchCount, m_iSynchTarget, and AnimatSim::Node::ResetSimulation().

Referenced by AnimatSim::Adapters::PropertyControlAdapter::ResetSimulation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float AnimatSim::Adapters::Adapter::RobotIOScale ( )
virtual

Gets the scale value used for calculated values for this adapter during simulation mode only.

If you are modeling a robot then you can use this to scale the IO of this adapter to match the real response of the robot. An example where this might be used is while simulating a motor. Real motors usually end up having a slightly slower response time than you get in the simulation. The value specified here is a percentage with 1 at 100%. To slow the simulated response time down slightly you could set it to 0.95 instead. This will only be applied during the simulation, NOT during the running of the real robot. This is only so you can try and tune your simulation repsonse to more closely match the real robot response.

Author
dcofer
Date
5/26/2014
Returns
IO percentage.

Definition at line 367 of file Adapter.cpp.

References m_fltRobotIOScale.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::RobotIOScale ( float  fltVal)
virtual

Sets the scale value used for calculated values for this adapter during simulation mode only.

If you are modeling a robot then you can use this to scale the IO of this adapter to match the real response of the robot. An example where this might be used is while simulating a motor. Real motors usually end up having a slightly slower response time than you get in the simulation. The value specified here is a percentage with 1 at 100%. To slow the simulated response time down slightly you could set it to 0.95 instead. This will only be applied during the simulation, NOT during the running of the real robot. This is only so you can try and tune your simulation repsonse to more closely match the real robot response.

Author
dcofer
Date
5/26/2014
Parameters
fltValnew IO percentage.

Definition at line 383 of file Adapter.cpp.

References m_fltRobotIOScale, and StdUtils::Std_IsAboveMin().

+ Here is the call graph for this function:

bool AnimatSim::Adapters::Adapter::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::Node.

Reimplemented in AnimatSim::Adapters::PropertyControlAdapter, and AnimatCarlSim::CsAdapter.

Definition at line 626 of file Adapter.cpp.

References AddGain(), DelayBufferInterval(), DelayBufferMode(), InitIODisableDuration(), RobotIOScale(), AnimatSim::Node::SetData(), StdUtils::Std_CheckString(), StdUtils::Std_ToBool(), SynchUpdateInterval(), SynchUpdateStartInterval(), and SynchWithRobot().

Referenced by AnimatSim::Adapters::PropertyControlAdapter::SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string AnimatSim::Adapters::Adapter::SourceDataType ( )
virtual

Gets the source data type.

Author
dcofer
Date
3/18/2011
Returns
Source data type.

Definition at line 154 of file Adapter.cpp.

References m_strSourceDataType.

void AnimatSim::Adapters::Adapter::SourceDataType ( std::string  strType)
virtual

Sets the source data type.

Author
dcofer
Date
3/18/2011
Parameters
strTypeSource DataType.

Definition at line 164 of file Adapter.cpp.

References m_strSourceDataType, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

std::string AnimatSim::Adapters::Adapter::SourceID ( )
virtual

Gets the GUID ID of the source node where we will get the source data variable.

Author
dcofer
Date
3/18/2011
Returns
GUID ID of the source node.

Definition at line 129 of file Adapter.cpp.

References m_strSourceID.

void AnimatSim::Adapters::Adapter::SourceID ( std::string  strID)
virtual

Sets the GUID ID of the Source node.

Author
dcofer
Date
3/18/2011
Parameters
strIDGUID ID for the source node.

Definition at line 139 of file Adapter.cpp.

References m_strSourceID, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

std::string AnimatSim::Adapters::Adapter::SourceModule ( )
virtual

Gets the name of the source NeuralModule.

Author
dcofer
Date
3/18/2011
Returns
Source NeuralModule name.

Reimplemented in AnimatSim::Adapters::ContactAdapter.

Definition at line 104 of file Adapter.cpp.

References m_strSourceModule.

void AnimatSim::Adapters::Adapter::SourceModule ( std::string  strName)
virtual

Sets the Source NeuralModule name.

Author
dcofer
Date
3/18/2011
Parameters
strNameName of the source NeuralModule.

Definition at line 114 of file Adapter.cpp.

References m_strSourceModule, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

Node * AnimatSim::Adapters::Adapter::SourceNode ( )
virtual

Gets the source node.

Author
dcofer
Date
3/18/2011
Returns
Pointer to the source node.

Definition at line 179 of file Adapter.cpp.

References m_lpSourceNode.

void AnimatSim::Adapters::Adapter::StepSimulation ( )
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.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Reimplemented in AnimatSim::Adapters::PropertyControlAdapter, and AnimatSim::Adapters::ContactAdapter.

Definition at line 825 of file Adapter.cpp.

References AnimatSim::Gains::Gain::CalculateGain(), AnimatSim::Simulator::InSimulation(), m_aryDelayBuffer, AnimatSim::AnimatBase::m_bEnabled, m_bSynchWithRobot, m_fltCalculatedVal, m_fltInitIODisableDuration, m_fltNextVal, m_fltRobotIOScale, m_fltUpdatedValue, m_iSynchCount, m_iSynchTarget, m_iSynchUpdateStartInterval, m_iTargetDataType, m_lpGain, AnimatSim::AnimatBase::m_lpSim, m_lpSourceData, AnimatSim::Simulator::RobotAdpaterSynch(), and AnimatSim::Simulator::Time().

+ Here is the call graph for this function:

float AnimatSim::Adapters::Adapter::SynchUpdateInterval ( )
virtual

This is how often we need to update this particular adapter.

For example, if you are using a round robin scheme with a robot IO update time of 5 ms with 4 motors, then you would set this to be 20 ms.

Author
dcofer
Date
6/30/2014
Returns
interval.

Definition at line 423 of file Adapter.cpp.

References m_fltSynchUpdateInterval.

Referenced by Initialize(), SetData(), and TimeStepModified().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::SynchUpdateInterval ( float  fltVal)
virtual

Determines how often we need to update this particular adapter.

Author
dcofer
Date
6/30/2014
Parameters
fltValinterval.

Definition at line 433 of file Adapter.cpp.

References m_fltSynchUpdateInterval, m_iSynchUpdateInterval, AnimatSim::AnimatBase::m_lpModule, AnimatSim::AnimatBase::m_lpSim, AnimatSim::Simulator::PhysicsTimeStep(), StdUtils::Std_IsAboveMin(), and AnimatSim::Behavior::NeuralModule::TimeStep().

+ Here is the call graph for this function:

float AnimatSim::Adapters::Adapter::SynchUpdateStartInterval ( )
virtual

This is the interval that this adapter waits the first time before doing its update.

For example, if you are using a round robin scheme with a robot IO update time of 5 ms with 4 motors, then the update interval would be set to 20 ms. You would set the start interval of motor 1 to 0, motor 2 to 5 ms, motor 3 to 10 ms, and motor 4 to 15 ms. This would stagger them in a round robin fashion the same way it was being processed on the real robot.

Author
dcofer
Date
6/30/2014
Returns
interval.

Definition at line 464 of file Adapter.cpp.

References m_fltSynchUpdateStartInterval.

Referenced by Initialize(), SetData(), and TimeStepModified().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::SynchUpdateStartInterval ( float  fltVal)
virtual

This is the interval that this adapter waits the first time before doing its update.

For example, if you are using a round robin scheme with a robot IO update time of 5 ms with 4 motors, then the update interval would be set to 20 ms. You would set the start interval of motor 1 to 0, motor 2 to 5 ms, motor 3 to 10 ms, and motor 4 to 15 ms. This would stagger them in a round robin fashion the same way it was being processed on the real robot.

Author
dcofer
Date
6/30/2014
Parameters
fltValinterval.

Definition at line 479 of file Adapter.cpp.

References m_fltSynchUpdateStartInterval, m_iSynchUpdateStartInterval, AnimatSim::AnimatBase::m_lpModule, AnimatSim::AnimatBase::m_lpSim, AnimatSim::Simulator::PhysicsTimeStep(), StdUtils::Std_IsAboveMin(), and AnimatSim::Behavior::NeuralModule::TimeStep().

+ Here is the call graph for this function:

bool AnimatSim::Adapters::Adapter::SynchWithRobot ( )
virtual

Gets whether the m_bRobotAdpaterSynch flag applies to this adapter.

Adpaters between neural elements should not need to be synched because they are not dependent on IO timing. This flag allows you to control this by setting it to false for adapters that do not need it.

Author
dcofer
Date
6/30/2014
Returns
Synch status of this adapter.

Definition at line 401 of file Adapter.cpp.

References m_bSynchWithRobot.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::SynchWithRobot ( bool  bVal)
virtual

Determines whether the m_bRobotAdpaterSynch flag applies to this adapter.

Author
dcofer
Date
6/30/2014
Parameters
bValSynch status of this adapter.

Definition at line 411 of file Adapter.cpp.

References m_bSynchWithRobot.

std::string AnimatSim::Adapters::Adapter::TargetDataType ( )
virtual

Gets the target data type.

Author
dcofer
Date
3/18/2011
Returns
Target data type.

Definition at line 240 of file Adapter.cpp.

References m_strTargetDataType.

void AnimatSim::Adapters::Adapter::TargetDataType ( std::string  strType)
virtual

Sets the target data type.

Author
dcofer
Date
3/18/2011
Parameters
strTypeTarget DataType.

Definition at line 250 of file Adapter.cpp.

References m_strTargetDataType.

std::string AnimatSim::Adapters::Adapter::TargetID ( )
virtual

Gets the GUID ID of the target node where we will add the transformed data variable.

Author
dcofer
Date
3/18/2011
Returns
GUID ID of the target node.

Definition at line 214 of file Adapter.cpp.

References m_strTargetID.

Referenced by AnimatSim::Adapters::PropertyControlAdapter::TargetID().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::Adapter::TargetID ( std::string  strID)
virtual

Sets the GUID ID of the target node.

Author
dcofer
Date
3/18/2011
Parameters
strIDGUID ID for the target node.

Reimplemented in AnimatSim::Adapters::PropertyControlAdapter.

Definition at line 225 of file Adapter.cpp.

References m_strTargetID, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

std::string AnimatSim::Adapters::Adapter::TargetModule ( )
virtual

Gets the name of the target NeuralModule.

Author
dcofer
Date
3/18/2011
Returns
Target NeuralModule name.

Reimplemented in AnimatSim::Adapters::ContactAdapter.

Definition at line 189 of file Adapter.cpp.

References m_strTargetModule.

void AnimatSim::Adapters::Adapter::TargetModule ( std::string  strName)
virtual

Sets the target NeuralModule name.

Author
dcofer
Date
3/18/2011
Parameters
strNameName of the target NeuralModule.

Reimplemented in AnimatSim::Adapters::ContactAdapter.

Definition at line 199 of file Adapter.cpp.

References m_strTargetModule, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

Node * AnimatSim::Adapters::Adapter::TargetNode ( )
virtual

Gets the target node.

Author
dcofer
Date
3/18/2011
Returns
Pointer to the target node.

Definition at line 263 of file Adapter.cpp.

References m_lpTargetNode.

void AnimatSim::Adapters::Adapter::TimeStepModified ( )
virtual

If the time step is modified then we need to recalculate the length of the delay buffer.

If a neural module has been assigned to this adapter then that is its target module and we need to use the time step associated with it to determine how big the delay buffer should be in length. If the module is NULL then the target for this adapter is the physics engine and we should use the physics time step instead.

Author
dcofer
Date
5/15/2014

Reimplemented from AnimatSim::AnimatBase.

Definition at line 729 of file Adapter.cpp.

References m_fltSynchUpdateInterval, m_fltSynchUpdateStartInterval, SynchUpdateInterval(), SynchUpdateStartInterval(), and AnimatSim::AnimatBase::TimeStepModified().

+ Here is the call graph for this function:

Member Data Documentation

CStdCircularArray<float> AnimatSim::Adapters::Adapter::m_aryDelayBuffer
protected

This buffer is used if the adapter has been setup to have delays between calcuating values and setting them in the target object.

Definition at line 95 of file Adapter.h.

Referenced by ResetSimulation(), and StepSimulation().

bool AnimatSim::Adapters::Adapter::m_bConnectedToPhysics
protected

This is true if either the target or soruce are connected to the physics engine. It is false if target and source are neural only.

Definition at line 79 of file Adapter.h.

Referenced by Adapter(), ConnectedToPhysics(), and Initialize().

bool AnimatSim::Adapters::Adapter::m_bSynchWithRobot
protected

Determines whether the m_bRobotAdpaterSynch flag applies to this adapter. Adpaters between neural elements should not need to be synched because they are not dependent on IO timing. This flag allows you to control this by setting it to false for adapters that do not need it.

Definition at line 100 of file Adapter.h.

Referenced by Adapter(), StepSimulation(), and SynchWithRobot().

float AnimatSim::Adapters::Adapter::m_fltInitIODisableDuration
protected

It is sometimes useful to disable IO operations briefly at the start of the simulation to give neural systems a chance to stabilize. This param defines how long it should disable IO for this adapter at the start of the sim.

Definition at line 131 of file Adapter.h.

Referenced by Adapter(), InitIODisableDuration(), and StepSimulation().

float AnimatSim::Adapters::Adapter::m_fltRobotIOScale
protected

If you are modeling a robot then you can use this to scale the IO of this adapter to match the real response of the robot. An example where this might be used is while simulating a motor. Real motors usually end up having a slightly slower response time than you get in the simulation. The value specified here is a percentage with 1 at 100%. To slow the simulated response time down slightly you could set it to 0.95 instead. This will only be applied during the simulation, NOT during the running of the real robot. This is only so you can try and tune your simulation repsonse to more closely match the real robot response.

Definition at line 127 of file Adapter.h.

Referenced by Adapter(), RobotIOScale(), and StepSimulation().

float AnimatSim::Adapters::Adapter::m_fltSynchUpdateStartInterval
protected

This determines the interval after IO Disable duration when the first update of this adapter takes place. This is primarily used to allow you to simulate IO updates are that are distributed over time, like in a round robin scheme. An example of this is the Dynamixel USB motors that get updated in a round robin.

Definition at line 111 of file Adapter.h.

Referenced by Adapter(), Initialize(), SynchUpdateStartInterval(), and TimeStepModified().

std::string AnimatSim::Adapters::Adapter::m_strTargetDataType
protected

DateType of the target variable that will be converted. This is converted to an int and passed to AddExternalNodeInput to define where the input should be routed.

Definition at line 66 of file Adapter.h.

Referenced by Initialize(), and TargetDataType().


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