AnimatLab  2
Test
AnimatSim::Environment::Organism Class Reference

A dynamic organism that is controlled by a neural network. More...

#include <Organism.h>

+ Inheritance diagram for AnimatSim::Environment::Organism:
+ Collaboration diagram for AnimatSim::Environment::Organism:

Public Member Functions

 Organism ()
 Default constructor. More...
 
virtual ~Organism ()
 Destructor. More...
 
virtual bool AddItem (const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
 Adds a new object to this parent. More...
 
virtual long CalculateSnapshotByteSize ()
 Calculates the snapshot byte size. More...
 
virtual AnimatSim::Behavior::NervousSystemGetNervousSystem ()
 
virtual RobotInterface * GetRobotInterface ()
 
virtual void Initialize ()
 Initializes this object. More...
 
virtual bool IsDead ()
 Query if this object is dead. More...
 
virtual void Kill (bool bState=true)
 Kills. More...
 
virtual void Load (CStdXml &oXml)
 
virtual void LoadKeyFrameSnapshot (byte *aryBytes, long &lIndex)
 Loads a key frame snapshot. More...
 
virtual void MinTimeStep (float &fltMin)
 
virtual bool RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true)
 Removes a child item from this parent. More...
 
virtual void ResetSimulation ()
 Resets the simulation back to time 0. More...
 
virtual void SaveKeyFrameSnapshot (byte *aryBytes, long &lIndex)
 Saves a key frame snapshot. 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 StepNeuralEngine ()
 Step neural engine. More...
 
virtual void StepPhysicsEngine ()
 Allows the organism and its parts to update at each time slice. More...
 
- Public Member Functions inherited from AnimatSim::Environment::Structure
 Structure ()
 Default constructor. More...
 
virtual ~Structure ()
 Destructor. More...
 
virtual void AddCollisionPair (std::string strID1, std::string strID2)
 Adds a collision pair to m_aryExcludeCollisionList. More...
 
void AddJoint (Joint *lpJoint)
 Adds a new joint to the list of all joints for this structure. More...
 
void AddRigidBody (RigidBody *lpBody)
 Adds a new rigid body to the list of all bodies for this structure. More...
 
virtual bool AllowRotateDragX ()
 Gets whether this body part can be rotated along the x-axis by the user with the drag handlers. More...
 
virtual bool AllowRotateDragY ()
 Gets whether this body part can be rotated along the y-axis by the user with the drag handlers. More...
 
virtual bool AllowRotateDragZ ()
 Gets whether this body part can be rotated along the z-axis by the user with the drag handlers. More...
 
virtual bool AllowTranslateDragX ()
 Gets whether this body part can be translated along the x-axis by the user with the drag handlers. More...
 
virtual bool AllowTranslateDragY ()
 Gets whether this body part can be translated along the y-axis by the user with the drag handlers. More...
 
virtual bool AllowTranslateDragZ ()
 Gets whether this body part can be translated along the z-axis by the user with the drag handlers. More...
 
virtual void Body (RigidBody *lpBody)
 Sets the root body. More...
 
virtual RigidBodyBody ()
 Gets the root body. More...
 
virtual void Create ()
 
virtual void DisableCollision (RigidBody *lpCollisionBody)
 Disables collision between the past-in object and all rigid bodies of this structure. More...
 
virtual void EnableCollision (RigidBody *lpCollisionBody)
 Enables collision between the past-in object and all rigid bodies of this structure. More...
 
virtual void EnableMotor (std::string strJointID, bool bVal)
 Enables the given joints motor. More...
 
virtual CStdPtrArray< CollisionPairExclusionList ()
 Gets the collision exclusion list as an array. More...
 
virtual JointFindJoint (std::string strJointID, bool bThrowError=true)
 Finds a joint with a specified ID within this structure. More...
 
virtual NodeFindNode (std::string strID, bool bThrowError=true)
 Searches for a Node with the given ID. More...
 
virtual RigidBodyFindRigidBody (std::string strBodyID, bool bThrowError=true)
 Finds a rigid body with a specified ID within this structure. More...
 
virtual float * GetDataPointer (const std::string &strDataType)
 Returns a float pointer to a data item of interest in this object. More...
 
virtual CStdFPoint Position ()
 Gets the local position. (m_oPosition) More...
 
virtual void Position (CStdFPoint &oPoint, bool bUseScaling=true, bool bFireChangeEvent=false, bool bUpdateMatrix=true)
 Sets the local position. (m_oPosition) More...
 
virtual void QueryProperties (CStdPtrArray< TypeProperty > &aryProperties)
 Queries this object for a list of properties that can be changed using SetData. More...
 
void RemoveJoint (std::string strID)
 Removes the joint with the specified ID. More...
 
void RemoveRigidBody (std::string strID)
 Removes the rigid body with the specified ID. More...
 
virtual void Script (ScriptProcessor *lpScript)
 
virtual ScriptProcessorScript ()
 
virtual void Selected (bool bValue, bool bSelectMultiple)
 Selects this object. More...
 
virtual void SetMotorInput (std::string strJointID, float fltInput)
 Sets the velocity for the specified joint. More...
 
virtual void SetSystemPointers (Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
 
void Sim (Simulator *lpSim)
 Sets the simulator object. 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 float Size ()
 Gets the size of the graphical representation of this joint. More...
 
virtual void Size (float fltVal, bool bUseScaling=true)
 Sets the size of the graphical representation of this joint. More...
 
virtual void UpdatePhysicsPosFromGraphics ()
 
- Public Member Functions inherited from AnimatSim::AnimatBase
 AnimatBase ()
 Constructs an AnimatBase object. More...
 
virtual ~AnimatBase ()
 Destroys the AnimatBase object.. More...
 
virtual void AfterResetSimulation ()
 Called after a simulation reset for some objects. More...
 
virtual void Copy (CStdSerialize *lpSource)
 
virtual void Enabled (bool bVal)
 Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications. More...
 
virtual bool Enabled ()
 Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications. 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 std::string Name ()
 Gets the name of this object. More...
 
virtual void Name (std::string strValue)
 Sets the name of the object. Blank is acceptable. More...
 
virtual AnimatPropertyType PropertyType (const std::string &strName)
 
virtual void ReInitialize ()
 Re-initialize this object. More...
 
virtual void Reset ()
 Resets this object. More...
 
virtual void RigidBodyAdded (std::string strID)
 
virtual void RigidBodyRemoved (std::string strID)
 
virtual bool Selected ()
 Tells if this items is selected or not. 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 SetSystemPointers (Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
 Sets the system pointers. More...
 
virtual void StepSimulation ()
 Step the simulation for this object. More...
 
virtual void TimeStepModified ()
 Notification method that the time step modified has been modified. Objects should recalculate any slice times as needed. 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 VerifySystemPointers ()
 Verify that system pointers have been set correctly. More...
 
virtual void VisualSelectionModeChanged (int iNewMode)
 Visual selection mode changed. More...
 
- Public Member Functions inherited from AnimatSim::Environment::MovableItem
 MovableItem (void)
 Default constructor. More...
 
virtual ~MovableItem (void)
 Destructor. More...
 
virtual CStdFPoint AbsolutePosition ()
 Gets the absolute position of this body part. More...
 
virtual void AbsolutePosition (CStdFPoint &oPoint)
 Sets the absolute position of this body part. (m_oAbsPosition) More...
 
virtual void AbsolutePosition (float fltX, float fltY, float fltZ)
 Sets the absolute position of this body part. (m_oAbsPosition) More...
 
virtual void AddBodyClicked (float fltPosX, float fltPosY, float fltPosZ, float fltNormX, float fltNormY, float fltNormZ)
 Called when the user clicks on this object while the AddBody mode is active. More...
 
virtual bool AllowMouseManipulation ()
 Tells if a given part can be manipulated using the mouse and draggers. More...
 
virtual float Alpha ()
 Gets the current alpha. More...
 
virtual void Alpha (float fltAlpha)
 Sets the current alpha. More...
 
virtual CStdColorAmbient ()
 Gets the ambient color value. More...
 
virtual void Ambient (CStdColor &aryColor)
 
virtual void Ambient (float *aryColor)
 Sets the Ambient color. More...
 
virtual void Ambient (std::string strXml)
 Loads the Ambient color from an XML data packet. More...
 
virtual bool CalculateLocalPosForWorldPos (float fltWorldX, float fltWorldY, float fltWorldZ, CStdFPoint &vLocalPos)
 Calculates the local position values for matrix transform for the part to be in a specific world position. More...
 
virtual IMovableItemCallbackCallback ()
 Gets the callback interface pointer. This is an interface pointer to a callback class that allows us to notify the GUI of events that occur within the simulation. More...
 
virtual void Callback (IMovableItemCallback *lpCallback)
 Sets the callback interface pointer. This is an interface pointer to a callback class that allows us to notify the GUI of events that occur within the simulation. More...
 
virtual float CollisionsAlpha ()
 Gets the collisions alpha. More...
 
virtual void CollisionsAlpha (float fltVal)
 Sets the collisions alpha. More...
 
virtual CStdColorDiffuse ()
 Gets the diffuse color. More...
 
virtual void Diffuse (CStdColor &aryColor)
 
virtual void Diffuse (float *aryColor)
 Sets the Diffuse color. More...
 
virtual void Diffuse (std::string strXml)
 Loads the Diffuse color from an XML data packet. More...
 
virtual BoundingBox GetBoundingBox ()
 Gets the bounding box for this part. More...
 
virtual float GetBoundingRadius ()
 Gets the bounding radius of this part. More...
 
virtual CStdFPoint GetCurrentPosition ()
 Gets the current position of this part. More...
 
virtual float GraphicsAlpha ()
 Gets the graphics alpha. More...
 
virtual void GraphicsAlpha (float fltVal)
 Sets the graphics alpha. More...
 
virtual bool IsSelected ()
 Query if this object is selected. More...
 
virtual bool IsVisible ()
 Query if this object is visible. More...
 
virtual void IsVisible (bool bVal)
 Sets whether this part is visible or not. More...
 
virtual float JointsAlpha ()
 Gets the joints alpha. More...
 
virtual void JointsAlpha (float fltVal)
 Sets the joints alpha. More...
 
virtual std::string LocalTransformationMatrixString ()
 Returns a string representation of the transformation matrix of this object. This is primarily used to save off the transform matrix into the project file. More...
 
virtual void OrientNewPart (float fltXPos, float fltYPos, float fltZPos, float fltXNorm, float fltYNorm, float fltZNorm)
 Orients a new part based on where the parent was clicked and the normal of the surface face. More...
 
RigidBodyParent ()
 Gets the parent RigidBody of this part. More...
 
void Parent (RigidBody *lpValue)
 Sets the parent RigidBody of this part. More...
 
virtual IPhysicsMovableItemPhysicsMovableItem ()
 Gets the physics body interface pointer. This is an interface reference to the Vs version of this object. It will allow us to call methods directly in the Vs (OSG) version of the object directly without having to overload a bunch of methods in each box, sphere, etc.. More...
 
virtual void PhysicsMovableItem (IPhysicsMovableItem *lpBase)
 Sets the physics body interface pointer. This is an interface reference to the Vs version of this object. It will allow us to call methods directly in the Vs (OSG) version of the object directly without having to overload a bunch of methods in each box, sphere, etc.. More...
 
virtual void Position (float fltX, float fltY, float fltZ, bool bUseScaling=true, bool bFireChangeEvent=false, bool bUpdateMatrix=true)
 Sets the local position. (m_oPosition) More...
 
virtual void Position (std::string strXml, bool bUseScaling=true, bool bFireChangeEvent=false, bool bUpdateMatrix=true)
 Sets the local position. (m_oPosition). This method is primarily used by the GUI to reset the local position using an xml data packet. More...
 
virtual float ReceptiveFieldsAlpha ()
 Gets the receptive fields alpha. More...
 
virtual void ReceptiveFieldsAlpha (float fltVal)
 Sets the receptive fields alpha. More...
 
virtual CStdFPoint ReportPosition ()
 Gets the reported local position. (m_oReportPosition). More...
 
virtual void ReportPosition (CStdFPoint &oPoint)
 Sets the reported local position. (m_oReportPosition). More...
 
virtual void ReportPosition (float fltX, float fltY, float fltZ)
 Sets the reported local position. (m_oReportPosition). More...
 
virtual CStdFPoint ReportRotation ()
 Gets the reported rotation of this part. (m_oReportRotation) More...
 
virtual void ReportRotation (CStdFPoint &oPoint)
 Sets the reported rotation of this part. (m_oReportRotation) More...
 
virtual void ReportRotation (float fltX, float fltY, float fltZ)
 Sets the reported rotation of this part. (m_oReportRotation) More...
 
virtual CStdFPoint ReportWorldPosition ()
 Gets the reported world position. (m_oReportWorldPosition) More...
 
virtual void ReportWorldPosition (CStdFPoint &oPoint)
 Sets the reported world position (m_oReportWorldPosition) More...
 
virtual void ReportWorldPosition (float fltX, float fltY, float fltZ)
 Sets the reported world position (m_oReportWorldPosition) More...
 
virtual CStdFPoint Rotation ()
 Gets the rotation of this body in radians. More...
 
virtual void Rotation (CStdFPoint &oPoint, bool bFireChangeEvent=false, bool bUpdateMatrix=true)
 Sets the rotation of this body in radians. (m_oRotation) More...
 
virtual void Rotation (float fltX, float fltY, float fltZ, bool bFireChangeEvent=false, bool bUpdateMatrix=true)
 Sets the rotation of this body in radians. (m_oRotation) More...
 
virtual void Rotation (std::string strXml, bool bFireChangeEvent=false, bool bUpdateMatrix=true)
 Sets the rotation of this body in radians. (m_oRotation). This method is primarily used by the GUI to reset the rotation using an xml data packet. More...
 
virtual CStdFPoint SelectedVertex ()
 Gets the relative position of the selected vertex. (m_vSelectedVertex) More...
 
virtual void SelectedVertex (CStdFPoint &vPoint, bool bFireChangeEvent=false, bool bUpdatePhysics=true)
 Sets the relative position of the selected vertex. (m_vSelectedVertex) More...
 
virtual void SelectedVertex (float fltX, float fltY, float fltZ, bool bFireChangeEvent=false, bool bUpdatePhysics=true)
 Sets the relative position of the selected vertex. (m_vSelectedVertex) More...
 
virtual void SetBoundingBox (int iIdx, float fltVal)
 Sets one dimension of the bounding box. This does nothing for all parts except a mesh. More...
 
virtual float Shininess ()
 Gets the shininess. More...
 
virtual void Shininess (float fltVal)
 Sets the shininess value. More...
 
virtual float SimulationAlpha ()
 Gets the simulation alpha. More...
 
virtual void SimulationAlpha (float fltVal)
 Sets the simulation alpha. More...
 
virtual CStdColorSpecular ()
 Gets the specular color. More...
 
virtual void Specular (CStdColor &aryColor)
 
virtual void Specular (float *aryColor)
 Sets the Specular color. More...
 
virtual void Specular (std::string strXml)
 Loads the Specular color from an XML data packet. More...
 
virtual std::string Texture ()
 Gets the texture filename. More...
 
virtual void Texture (std::string strValue)
 Sets the Texture filename. More...
 
virtual CStdFPoint UpdateAbsolutePosition ()
 
virtual void UserDefinedDraggerRadius (float fltRadius)
 User defined dragger radius. More...
 
virtual float UserDefinedDraggerRadius ()
 Gets the user defined dragger radius. More...
 
virtual void VisualSelectionModeChanged (int iNewMode)
 Called when the visual selection mode changed in GUI. More...
 
virtual int VisualSelectionType ()
 Gets the visual selection type for this part. More...
 

Static Public Member Functions

static OrganismCastToDerived (AnimatBase *lpBase)
 
- Static Public Member Functions inherited from AnimatSim::Environment::Structure
static StructureCastToDerived (AnimatBase *lpBase)
 

Protected Member Functions

virtual RobotInterfaceAddRobotInterface (std::string strXml)
 Creates and adds a robot interface control. More...
 
virtual RobotInterfaceLoadRobotInterface (CStdXml &oXml)
 Loads a robot interface Control. More...
 
virtual void RemoveRobotInterface (std::string strID, bool bThrowError=true)
 Removes the robot interface with the specified ID. More...
 
- Protected Member Functions inherited from AnimatSim::Environment::Structure
virtual void AddRoot (std::string strXml)
 Creates and adds a root body part. More...
 
virtual void AddScript (std::string strXml)
 Creates and adds a scripting object to this structure. More...
 
virtual void LoadCollisionPair (CStdXml &oXml)
 Loads a collision pair. More...
 
virtual void LoadLayout (CStdXml &oXml)
 Loads the layout for this structure from an asl configuration file. More...
 
virtual RigidBodyLoadRoot (CStdXml &oXml)
 Loads the root rigid body. More...
 
virtual ScriptProcessorLoadScript (CStdXml &oXml)
 Loads the script. More...
 
virtual void RemoveRoot (std::string strID, bool bThrowError=true)
 Removes the root based on ID. More...
 
virtual void RemoveScript (std::string strID, bool bThrowError=true)
 Removes the script based on ID. More...
 
virtual void UpdateData ()
 Collects reporting data for the structure at each time step. More...
 
- Protected Member Functions inherited from AnimatSim::Environment::MovableItem
virtual void LoadPosition (CStdXml &oXml)
 Loads the items position. More...
 
virtual void LoadRotation (CStdXml &oXml)
 Loads the items rotation. More...
 

Protected Attributes

bool m_bDead
 Tells if the organism is dead or not.
 
NervousSystem * m_lpNervousSystem
 The pointer to the nervous system.
 
RobotInterface * m_lpRobot
 Pointer to a robot interface node to allow the organism to be hooked to a robot.
 
- Protected Attributes inherited from AnimatSim::Environment::Structure
CStdPtrArray< CollisionPairm_aryExcludeCollisionList
 This is the list of other body part ID's to exclude from collision tests.
 
CStdMap< std::string, Joint * > m_aryJoints
 
CStdMap< std::string, RigidBody * > m_aryRigidBodies
 
float m_fltSize
 The radius of the graphical sphere shown for the structure position.
 
RigidBodym_lpBody
 The root rigid body object of this structure.
 
IMovableItemCallbackm_lpCallback
 
ScriptProcessorm_lpScript
 Script processor for running python or other scripting systems related to this structure.
 
- 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..
 
- Protected Attributes inherited from AnimatSim::Environment::MovableItem
bool m_bIsSelected
 Keeps track of whether this movable item has been selected or not.
 
bool m_bIsVisible
 
float m_fltAlpha
 The current alpha transparency for this body part.
 
float m_fltCollisionsAlpha
 The alpha transparency used in the Collisions VisualSelectionMode.
 
float m_fltGraphicsAlpha
 The alpha transparency used in the Graphics VisualSelectionMode.
 
float m_fltJointsAlpha
 The alpha transparency used in the Joints VisualSelectionMode.
 
float m_fltReceptiveFieldsAlpha
 The alpha transparency used in the Receptive Fields VisualSelectionMode.
 
float m_fltReportIsVisible
 
float m_fltShininess
 The shininess of the part. A value between 0 and 128.
 
float m_fltSimulationAlpha
 The alpha transparency used in the Simulation VisualSelectionMode.
 
float m_fltUserDefinedDraggerRadius
 User defined drag handle radius. If this is -1 then the user has not set the value and the default is used.
 
IMovableItemCallbackm_lpCallback
 
Simulatorm_lpMovableSim
 The pointer to a Simulation.
 
RigidBodym_lpParent
 
IPhysicsMovableItemm_lpPhysicsMovableItem
 
CStdFPoint m_oAbsPosition
 
CStdFPoint m_oPosition
 These are rotation and position coords relative to the parent if this is a body part.
 
CStdFPoint m_oReportPosition
 This is used for reporting the position back to the GUI. It is the position scaled for distance units.
 
CStdFPoint m_oReportRotation
 
CStdFPoint m_oReportWorldPosition
 This is used for reporting the position back to the GUI. It is the world position scaled for distance units.
 
CStdFPoint m_oRotation
 
std::string m_strTexture
 An optional texture to apply to the rigid body.
 
CStdColor m_vAmbient
 The ambient color to apply to this part. It is specified as red, green, blue, and alpha.
 
CStdColor m_vDiffuse
 The diffuse color to apply to this part. It is specified as red, green, blue, and alpha.
 
CStdFPoint m_vSelectedVertex
 The relative position of the selected vertex.
 
CStdColor m_vSpecular
 The specular color to apply to this part. It is specified as red, green, blue, and alpha.
 

Detailed Description

A dynamic organism that is controlled by a neural network.

An organism is a type of Structure. The difference between an organism and a structure is the same as that between a crayfish and a rock. A crayfish is an object that thinks and can move on its own. To do this it uses its brain to control the movements of its muscles. So unlike a structure, an organism contains a neural network that is attached to the motor neurons to control the movements of the limbs, and to sensory neurons to detect signals from the environment. This allows it to produce independent behavior.

Author
dcofer
Date
2/25/2011

Definition at line 31 of file Organism.h.

Constructor & Destructor Documentation

Organism::Organism ( )

Default constructor.

Author
dcofer
Date
2/25/2011

Definition at line 50 of file Organism.cpp.

References m_bDead, m_lpNervousSystem, and m_lpRobot.

Organism::~Organism ( )
virtual

Destructor.

Author
dcofer
Date
2/25/2011

Definition at line 63 of file Organism.cpp.

References m_lpNervousSystem, m_lpRobot, and StdUtils::Std_TraceMsg().

+ Here is the call graph for this function:

Member Function Documentation

bool Organism::AddItem ( const std::string &  strItemType,
const std::string &  strXml,
bool  bThrowError = true,
bool  bDoNotInit = false 
)
virtual

Adds a new object to this parent.

Generic method to add a new child item to this parent by specifying a string item type descriptor and an xml packet that can be used to load in the new object. The GUI uses this method to create new items that were added with the user interface. The item type lets the method determine what type of item is being created, like synapse, neuron, body part, etc.. It then gets the modulename, classname, and type from the xml and calls CreateObject to create the appropriate type of object. Then it passes in the xml packet to the new objects load method and does any needed initialization and adds it to the parent.

Author
dcofer
Date
2/22/2011
Parameters
strItemTypeString descriptor of the type of item that is being created.
strXmlXML packet that is used to create and load the new item.
bThrowErrorIf true then throw an error if there is a problem, otherwise return false.
Returns
true if it succeeds, false if it fails.

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 232 of file Organism.cpp.

References AnimatSim::Environment::Structure::AddItem(), AnimatSim::Behavior::NervousSystem::AddNeuralModule(), AddRobotInterface(), m_lpNervousSystem, and StdUtils::Std_CheckString().

+ Here is the call graph for this function:

RobotInterface * Organism::AddRobotInterface ( std::string  strXml)
protectedvirtual

Creates and adds a robot interface control.

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

Definition at line 199 of file Organism.cpp.

References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), AnimatSim::Robotics::RobotInterface::Initialize(), and LoadRobotInterface().

Referenced by AddItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

long Organism::CalculateSnapshotByteSize ( )
virtual

Calculates the snapshot byte size.

Sometimes the user may want to capture a snapshot of the simulation at a given point in time, and then be able to go back to that specific point. To do this we grab a snapshot of all the data in the system, including the neural variables. We essentially serialize the data into a binary format for later re-use. This method calculates the number of bytes that will be required to store the entire nervous system.

Author
dcofer
Date
2/24/2011
Returns
The calculated snapshot byte size.

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 315 of file Organism.cpp.

References AnimatSim::Behavior::NervousSystem::CalculateSnapshotByteSize(), and m_lpNervousSystem.

+ Here is the call graph for this function:

void Organism::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::Environment::Structure.

Definition at line 108 of file Organism.cpp.

References AnimatSim::Robotics::RobotInterface::Initialize(), AnimatSim::Behavior::NervousSystem::Initialize(), AnimatSim::Environment::Structure::Initialize(), m_lpNervousSystem, and m_lpRobot.

+ Here is the call graph for this function:

bool Organism::IsDead ( )
virtual

Query if this object is dead.

Author
dcofer
Date
2/25/2011
Returns
true if dead, false if not.

Definition at line 92 of file Organism.cpp.

References m_bDead.

void Organism::Kill ( bool  bState = true)
virtual

Kills.

Called to kill the organism, nervous system, neurons, and body parts. All neural items are disabled to prevent any further neural activity, and all joints are disabled to allow free rotation, and all biomechancical components are disabled so they can no longer produce forces. This method is only relevant to these types of objects, but I am putting the definition in the base class because a variety of different types of classes all need this method and I want it consolidated. Those classes that do not need it do not have to call it or do anything when it is called.

Author
dcofer
Date
3/3/2011
Parameters
bStatetrue to state.

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 95 of file Organism.cpp.

References AnimatSim::Behavior::NervousSystem::Kill(), AnimatSim::Environment::Structure::Kill(), AnimatSim::Environment::RigidBody::Kill(), m_bDead, AnimatSim::Environment::Structure::m_lpBody, and m_lpNervousSystem.

Referenced by ResetSimulation(), and AnimatSim::Environment::Bodies::Stomach::StepSimulation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Organism::LoadKeyFrameSnapshot ( byte *  aryBytes,
long &  lIndex 
)
virtual

Loads a key frame snapshot.

Sometimes the user may want to capture a snapshot of the simulation at a given point in time, and then be able to go back to that specific point. To do this we grab a snapshot of all the data in the system, including the neural variables. We essentially serialize the data into a binary format for later re-use. This method goes through each module and loads its data from the byte array.

Author
dcofer
Date
2/24/2011
Parameters
[in,out]aryBytesThe array of bytes where the data is being stored.
[in,out]lIndexCurrent zero-based index of the read position in the array.

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 321 of file Organism.cpp.

References AnimatSim::Behavior::NervousSystem::LoadKeyFrameSnapshot(), and m_lpNervousSystem.

+ Here is the call graph for this function:

RobotInterface * Organism::LoadRobotInterface ( CStdXml oXml)
protectedvirtual

Loads a robot interface Control.

Author
dcofer
Date
3/2/2011
Parameters
[in,out]oXmlThe xml data definition of the part to load.
Returns
null if it fails, else the IO control.

Definition at line 335 of file Organism.cpp.

References AnimatSim::Simulator::CreateObject(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::GetChildString(), StdUtils::CStdXml::IntoChildElement(), AnimatSim::AnimatBase::m_lpModule, m_lpRobot, AnimatSim::AnimatBase::m_lpSim, StdUtils::CStdXml::OutOfElem(), and AnimatSim::AnimatBase::SetSystemPointers().

Referenced by AddRobotInterface().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Organism::RemoveItem ( const std::string &  strItemType,
const std::string &  strID,
bool  bThrowError = true 
)
virtual

Removes a child item from this parent.

This is a generic method that is used to delete a child object from this parent. The GUI uses this method to remove objects from the simulation that have been deleted in the UI. The item type lets the method determine what type of item is being deleted, like synapse, neuron, body part, etc.. The ID is then used to delete that specific item.

Author
dcofer
Date
2/22/2011
Parameters
strItemTypeString descriptor of the type of item that is being created.
strIDUnique ID of the item that will be removed.
bThrowErrorIf true then throw an error if there is a problem, otherwise return false.
Returns
true if it succeeds, false if it fails.

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 266 of file Organism.cpp.

References m_lpNervousSystem, AnimatSim::Environment::Structure::RemoveItem(), AnimatSim::Behavior::NervousSystem::RemoveNeuralModule(), RemoveRobotInterface(), and StdUtils::Std_CheckString().

+ Here is the call graph for this function:

void Organism::RemoveRobotInterface ( std::string  strID,
bool  bThrowError = true 
)
protectedvirtual

Removes the robot interface with the specified ID.

Author
dcofer
Date
3/2/2011
Parameters
strIDID of the body to remove
bThrowErrorIf true and ID is not found then it will throw an error.
Exceptions
IfbThrowError is true and ID is not found.

Definition at line 223 of file Organism.cpp.

References AnimatSim::AnimatBase::ID(), m_lpRobot, and StdUtils::Std_CheckString().

Referenced by RemoveItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Organism::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::Environment::Structure.

Reimplemented in VortexAnimatSim::Environment::VsOrganism, OsgAnimatSim::Environment::OsgOrganism, and RoboticsAnimatSim::Environment::RbOrganism.

Definition at line 119 of file Organism.cpp.

References Kill(), m_lpNervousSystem, m_lpRobot, AnimatSim::Behavior::NervousSystem::ResetSimulation(), AnimatSim::Robotics::RobotInterface::ResetSimulation(), and AnimatSim::Environment::Structure::ResetSimulation().

+ Here is the call graph for this function:

void Organism::SaveKeyFrameSnapshot ( byte *  aryBytes,
long &  lIndex 
)
virtual

Saves a key frame snapshot.

Sometimes the user may want to capture a snapshot of the simulation at a given point in time, and then be able to go back to that specific point. To do this we grab a snapshot of all the data in the system, including the neural variables. We essentially serialize the data into a binary format for later re-use. This method goes through each module and saves its data into the byte array.

Author
dcofer
Date
2/24/2011
Parameters
[in,out]aryBytesThe array of bytes where the data is being stored.
[in,out]lIndexCurrent zero-based index of the write position in the array.

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 318 of file Organism.cpp.

References m_lpNervousSystem, and AnimatSim::Behavior::NervousSystem::SaveKeyFrameSnapshot().

+ Here is the call graph for this function:

bool Organism::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::Environment::Structure.

Definition at line 170 of file Organism.cpp.

References AnimatSim::Environment::Structure::SetData(), and StdUtils::Std_CheckString().

+ Here is the call graph for this function:

void Organism::StepNeuralEngine ( )
virtual

Step neural engine.

Author
dcofer
Date
3/2/2011

Definition at line 141 of file Organism.cpp.

References m_bDead, m_lpNervousSystem, AnimatSim::Environment::Structure::m_lpScript, and AnimatSim::Behavior::NervousSystem::StepSimulation().

Referenced by AnimatSim::Simulator::StepNeuralEngine().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Organism::StepPhysicsEngine ( )
virtual

Allows the organism and its parts to update at each time slice.

This function is called for each structure/organism at every time slice. It gives the structures a chance to update any values. For instance, the hydrodynamic simulation code needs to manually add drag and buoyancy forces to each rigid body every time slice. You need to be VERY careful to keep all code within the StepSimulation methods short, sweet, and very fast. They are in the main processing loop and even a small increase in the amount of processing time that occurrs within this loop will lead to major impacts on the ultimate performance of the system.

Author
dcofer
Date
2/25/2011

Reimplemented from AnimatSim::Environment::Structure.

Definition at line 155 of file Organism.cpp.

References AnimatSim::AnimatBase::Enabled(), m_lpRobot, AnimatSim::Environment::Structure::StepPhysicsEngine(), and AnimatSim::Robotics::RobotInterface::StepSimulation().

+ Here is the call graph for this function:


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