AnimatLab  2
Test
AnimatSim::Adapters::PropertyControlAdapter Class Reference
+ Inheritance diagram for AnimatSim::Adapters::PropertyControlAdapter:
+ Collaboration diagram for AnimatSim::Adapters::PropertyControlAdapter:

Public Member Functions

 PropertyControlAdapter ()
 Default constructor. More...
 
virtual ~PropertyControlAdapter ()
 Destructor. More...
 
virtual void FinalValue (float fltVal)
 Sets the final value used to set this property when the simulation ends. More...
 
virtual float FinalValue ()
 Gets the final value used to set this property when the simulation ends. More...
 
virtual void Initialize ()
 Initializes this object. More...
 
virtual void InitialValue (float fltVal)
 Sets the initial value used to set this property when the simulation starts. More...
 
virtual float InitialValue ()
 Gets vthe initial value used to set this property when the simulation starts. More...
 
virtual void Load (CStdXml &oXml)
 
virtual void PropertyName (std::string strPropName)
 Sets the name of the property that this adapter will be setting. More...
 
virtual std::string PropertyName ()
 Gets the name of the property that this adapter will be setting. 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 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 SetThreshold (float fltThreshold)
 Sets the threshold used for setting the value on the target object. More...
 
virtual float SetThreshold ()
 Gets the threshold value used for determining when to set the value on the target object. More...
 
virtual void SimStarting ()
 Called just before the simulation starts. More...
 
virtual void StepSimulation ()
 Step the simulation for this object. More...
 
virtual void TargetID (std::string strID)
 Sets the GUID ID of the target node. More...
 
virtual AnimatBaseTargetObject ()
 Gets the target object. 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 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 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 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 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 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 PropertyControlAdapterCastToDerived (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 SetDestinationID (std::string strXml)
 
virtual void SetPropertyValue (float fltVal)
 
- 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 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

AnimatPropertyType m_ePropertyType
 
float m_fltFinalValue
 
float m_fltInitialValue
 
float m_fltPreviousSetVal
 
float m_fltSetThreshold
 
AnimatBasem_lpTargetObject
 Pointer to the target node.
 
std::string m_strPropertyName
 
- 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

Definition at line 30 of file PropertyControlAdapter.h.

Constructor & Destructor Documentation

AnimatSim::Adapters::PropertyControlAdapter::PropertyControlAdapter ( )

Default constructor.

Author
dcofer
Date
3/18/2011

Definition at line 53 of file PropertyControlAdapter.cpp.

References m_lpTargetObject.

AnimatSim::Adapters::PropertyControlAdapter::~PropertyControlAdapter ( )
virtual

Destructor.

Author
dcofer
Date
3/18/2011

Definition at line 68 of file PropertyControlAdapter.cpp.

References m_lpTargetObject, and StdUtils::Std_TraceMsg().

+ Here is the call graph for this function:

Member Function Documentation

void AnimatSim::Adapters::PropertyControlAdapter::FinalValue ( float  fltVal)
virtual

Sets the final value used to set this property when the simulation ends.

Author
dcofer
Date
2/6/2013
Returns
Nothing.

Definition at line 193 of file PropertyControlAdapter.cpp.

float AnimatSim::Adapters::PropertyControlAdapter::FinalValue ( )
virtual

Gets the final value used to set this property when the simulation ends.

Author
dcofer
Date
2/6/2013
Returns
final value.

Definition at line 206 of file PropertyControlAdapter.cpp.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::PropertyControlAdapter::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 289 of file PropertyControlAdapter.cpp.

References AnimatSim::Simulator::FindByID(), AnimatSim::AnimatBase::GetDataPointer(), AnimatSim::AnimatBase::ID(), AnimatSim::AnimatBase::Initialize(), AnimatSim::AnimatBase::m_lpSim, AnimatSim::Adapters::Adapter::m_lpSourceData, AnimatSim::Adapters::Adapter::m_lpSourceNode, AnimatSim::AnimatBase::m_lpStructure, AnimatSim::Adapters::Adapter::m_lpTargetNode, m_lpTargetObject, AnimatSim::AnimatBase::m_strID, AnimatSim::Adapters::Adapter::m_strSourceDataType, AnimatSim::Adapters::Adapter::m_strSourceID, AnimatSim::Adapters::Adapter::m_strTargetID, and PropertyName().

+ Here is the call graph for this function:

void AnimatSim::Adapters::PropertyControlAdapter::InitialValue ( float  fltVal)
virtual

Sets the initial value used to set this property when the simulation starts.

Author
dcofer
Date
2/6/2013
Returns
Nothing.

Definition at line 168 of file PropertyControlAdapter.cpp.

float AnimatSim::Adapters::PropertyControlAdapter::InitialValue ( )
virtual

Gets vthe initial value used to set this property when the simulation starts.

Author
dcofer
Date
2/6/2013
Returns
Initial value.

Definition at line 182 of file PropertyControlAdapter.cpp.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::PropertyControlAdapter::PropertyName ( std::string  strPropName)
virtual

Sets the name of the property that this adapter will be setting.

Author
dcofer
Date
2/6/2013
Returns
nothing.

Definition at line 94 of file PropertyControlAdapter.cpp.

References AnimatSim::AnimatBase::HasProperty(), m_lpTargetObject, AnimatSim::AnimatBase::m_strID, StdUtils::Std_IsBlank(), and StdUtils::Std_Trim().

+ Here is the call graph for this function:

std::string AnimatSim::Adapters::PropertyControlAdapter::PropertyName ( )
virtual

Gets the name of the property that this adapter will be setting.

Author
dcofer
Date
2/6/2013
Returns
Name of property that will be set.

Definition at line 127 of file PropertyControlAdapter.cpp.

Referenced by Initialize(), and SetData().

+ Here is the caller graph for this function:

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

Definition at line 257 of file PropertyControlAdapter.cpp.

References AnimatSim::Adapters::Adapter::QueryProperties().

+ Here is the call graph for this function:

void AnimatSim::Adapters::PropertyControlAdapter::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 267 of file PropertyControlAdapter.cpp.

References AnimatSim::AnimatBase::m_bEnabled, m_lpTargetObject, AnimatSim::Adapters::Adapter::ResetSimulation(), and AnimatSim::AnimatBase::SetData().

+ Here is the call graph for this function:

bool AnimatSim::Adapters::PropertyControlAdapter::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 219 of file PropertyControlAdapter.cpp.

References FinalValue(), InitialValue(), PropertyName(), AnimatSim::Adapters::Adapter::SetData(), SetThreshold(), and StdUtils::Std_CheckString().

+ Here is the call graph for this function:

void AnimatSim::Adapters::PropertyControlAdapter::SetThreshold ( float  fltThreshold)
virtual

Sets the threshold used for setting the value on the target object.

If the absolute value of the current value - the last value when set is exceeded then this will trigger the adapter to set the value again.

Author
dcofer
Date
2/6/2013
Returns
Pointer to the target object.

Definition at line 141 of file PropertyControlAdapter.cpp.

float AnimatSim::Adapters::PropertyControlAdapter::SetThreshold ( )
virtual

Gets the threshold value used for determining when to set the value on the target object.

Author
dcofer
Date
2/6/2013
Returns
threshold value.

Definition at line 157 of file PropertyControlAdapter.cpp.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Adapters::PropertyControlAdapter::SimStarting ( )
virtual

Called just before the simulation starts.

This method is called on each AnimatBase object when the simulation starts. It allows it to perform any intialization prior to the beginning of the simulation that is needed.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Definition at line 279 of file PropertyControlAdapter.cpp.

References AnimatSim::AnimatBase::m_bEnabled, m_lpTargetObject, and AnimatSim::AnimatBase::SetData().

+ Here is the call graph for this function:

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

Definition at line 345 of file PropertyControlAdapter.cpp.

References AnimatSim::Gains::Gain::CalculateGain(), AnimatSim::AnimatBase::m_bEnabled, AnimatSim::Adapters::Adapter::m_lpGain, and AnimatSim::Adapters::Adapter::m_lpSourceData.

+ Here is the call graph for this function:

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

Definition at line 80 of file PropertyControlAdapter.cpp.

References m_lpTargetObject, and AnimatSim::Adapters::Adapter::TargetID().

+ Here is the call graph for this function:

AnimatBase * AnimatSim::Adapters::PropertyControlAdapter::TargetObject ( )
virtual

Gets the target object.

Author
dcofer
Date
2/6/2013
Returns
Pointer to the target object.

Definition at line 217 of file PropertyControlAdapter.cpp.

References m_lpTargetObject.


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