AnimatLab
2
Test
|
#include <Adapter.h>
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 Gain * | GetGain () |
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 Node * | SourceNode () |
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 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 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 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 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 Adapter * | CastToDerived (AnimatBase *lpBase) |
Static Public Member Functions inherited from AnimatSim::Node | |
static Node * | CastToDerived (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. | |
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.. | |
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.
AnimatSim::Adapters::Adapter::Adapter | ( | ) |
Default constructor.
Definition at line 52 of file Adapter.cpp.
References m_bConnectedToPhysics, m_bSynchWithRobot, m_fltCalculatedVal, m_fltInitIODisableDuration, m_fltNextVal, m_fltRobotIOScale, m_fltSynchUpdateInterval, m_fltSynchUpdateStartInterval, m_fltUpdatedValue, m_iSynchCount, m_iSynchTarget, m_iSynchUpdateInterval, m_iSynchUpdateStartInterval, m_iTargetDataType, m_lpGain, m_lpSourceData, m_lpSourceNode, and m_lpTargetNode.
|
virtual |
Destructor.
Definition at line 82 of file Adapter.cpp.
References m_lpGain, m_lpSourceData, m_lpSourceNode, m_lpTargetNode, and StdUtils::Std_TraceMsg().
|
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.
iTargetDataType | The index of the target data type we are adding to. |
fltInput | The new input. |
Implements AnimatSim::Node.
Definition at line 539 of file Adapter.cpp.
|
protectedvirtual |
Creates and adds a gain object.
strXml | The 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().
|
virtual |
Returns whether or not this adpater is connected to a physics object or not.
Definition at line 295 of file Adapter.cpp.
References m_bConnectedToPhysics.
|
virtual |
Returns the time interval used for the delay buffer if this adapter is set to use one.
Definition at line 336 of file Adapter.cpp.
Referenced by SetData().
|
virtual |
Sets the time interval used for the delay buffer if this adapter is set to use one.
fltVal | new time step. |
Definition at line 346 of file Adapter.cpp.
References StdUtils::Std_IsAboveMin().
|
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.
Definition at line 307 of file Adapter.cpp.
Referenced by SetData().
|
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.
eMode | new mode. |
Definition at line 322 of file Adapter.cpp.
|
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.
strDataType | name of the data item for which we are looking. |
If | DataType 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().
|
virtual |
Gets the poitner to the gain function.
Definition at line 273 of file Adapter.cpp.
References m_lpGain.
|
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::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().
|
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..
Definition at line 508 of file Adapter.cpp.
References m_fltInitIODisableDuration.
Referenced by SetData().
|
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..
fltVal | duration 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().
|
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.
aryNames | Array list of the property names. |
strTypes | Array list of the type that is associated with the cooresponding name in the list. |
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().
|
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.
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().
|
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.
Definition at line 367 of file Adapter.cpp.
References m_fltRobotIOScale.
Referenced by SetData().
|
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.
fltVal | new IO percentage. |
Definition at line 383 of file Adapter.cpp.
References m_fltRobotIOScale, and StdUtils::Std_IsAboveMin().
|
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.
strDataType | string name of the data type to set. |
strValue | The 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. |
bThrowError | true to throw error if there is a problem. If false then it will not return an error, just return false. |
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().
|
virtual |
Gets the source data type.
Definition at line 154 of file Adapter.cpp.
References m_strSourceDataType.
|
virtual |
Sets the source data type.
strType | Source DataType. |
Definition at line 164 of file Adapter.cpp.
References m_strSourceDataType, and StdUtils::Std_IsBlank().
|
virtual |
Gets the GUID ID of the source node where we will get the source data variable.
Definition at line 129 of file Adapter.cpp.
References m_strSourceID.
|
virtual |
Sets the GUID ID of the Source node.
strID | GUID ID for the source node. |
Definition at line 139 of file Adapter.cpp.
References m_strSourceID, and StdUtils::Std_IsBlank().
|
virtual |
Gets the name of the source NeuralModule.
Reimplemented in AnimatSim::Adapters::ContactAdapter.
Definition at line 104 of file Adapter.cpp.
References m_strSourceModule.
|
virtual |
Sets the Source NeuralModule name.
strName | Name of the source NeuralModule. |
Definition at line 114 of file Adapter.cpp.
References m_strSourceModule, and StdUtils::Std_IsBlank().
|
virtual |
Gets the source node.
Definition at line 179 of file Adapter.cpp.
References m_lpSourceNode.
|
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::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().
|
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.
Definition at line 423 of file Adapter.cpp.
References m_fltSynchUpdateInterval.
Referenced by Initialize(), SetData(), and TimeStepModified().
|
virtual |
Determines how often we need to update this particular adapter.
fltVal | interval. |
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().
|
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.
Definition at line 464 of file Adapter.cpp.
References m_fltSynchUpdateStartInterval.
Referenced by Initialize(), SetData(), and TimeStepModified().
|
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.
fltVal | interval. |
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().
|
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.
Definition at line 401 of file Adapter.cpp.
References m_bSynchWithRobot.
Referenced by SetData().
|
virtual |
Determines whether the m_bRobotAdpaterSynch flag applies to this adapter.
bVal | Synch status of this adapter. |
Definition at line 411 of file Adapter.cpp.
References m_bSynchWithRobot.
|
virtual |
Gets the target data type.
Definition at line 240 of file Adapter.cpp.
References m_strTargetDataType.
|
virtual |
Sets the target data type.
strType | Target DataType. |
Definition at line 250 of file Adapter.cpp.
References m_strTargetDataType.
|
virtual |
Gets the GUID ID of the target node where we will add the transformed data variable.
Definition at line 214 of file Adapter.cpp.
References m_strTargetID.
Referenced by AnimatSim::Adapters::PropertyControlAdapter::TargetID().
|
virtual |
Sets the GUID ID of the target node.
strID | GUID 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().
|
virtual |
Gets the name of the target NeuralModule.
Reimplemented in AnimatSim::Adapters::ContactAdapter.
Definition at line 189 of file Adapter.cpp.
References m_strTargetModule.
|
virtual |
Sets the target NeuralModule name.
strName | Name of the target NeuralModule. |
Reimplemented in AnimatSim::Adapters::ContactAdapter.
Definition at line 199 of file Adapter.cpp.
References m_strTargetModule, and StdUtils::Std_IsBlank().
|
virtual |
Gets the target node.
Definition at line 263 of file Adapter.cpp.
References m_lpTargetNode.
|
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.
Reimplemented from AnimatSim::AnimatBase.
Definition at line 729 of file Adapter.cpp.
References m_fltSynchUpdateInterval, m_fltSynchUpdateStartInterval, SynchUpdateInterval(), SynchUpdateStartInterval(), and AnimatSim::AnimatBase::TimeStepModified().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().