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

A "static" structure in the simulation. More...

#include <Structure.h>

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

Public Member Functions

 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...
 
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...
 
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 long CalculateSnapshotByteSize ()
 Calculates the snapshot byte size. 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 RobotInterface * GetRobotInterface ()
 
virtual void Initialize ()
 Initializes this object. 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 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...
 
virtual bool RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true)
 Removes a child item from this parent. 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 ResetSimulation ()
 Resets the simulation back to time 0. More...
 
virtual void SaveKeyFrameSnapshot (byte *aryBytes, long &lIndex)
 Saves a key frame snapshot. More...
 
virtual void Script (ScriptProcessor *lpScript)
 
virtual ScriptProcessorScript ()
 
virtual void Selected (bool bValue, bool bSelectMultiple)
 Selects this object. 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 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 StepPhysicsEngine ()
 Allows the organism and its parts to update at each time slice. 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 StructureCastToDerived (AnimatBase *lpBase)
 

Protected Member Functions

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

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 "static" structure in the simulation.

Remarks
This object is a "static" structure in the simulation. I say "static" because can move, but it is part of the background environment and does not have a brain controlling its movement. For example, if you wanted to have a house as an obstacle in the environemt then that house would probably have a door. The door would be connected to the wall of the house using a hinge joint. So the door can open and close, but it does not have a brain to control its movement. Another example is a rock. If you create a rock and place it at a precarious position on the top of a hill then it will move by rolling down the hill, but this is a passive effect of gravity acting on the body of the rock, and not something that the rock actively did. An organism on the other hand does have a neural network that actively controls the movements of its limbs to change its position and orientation within the world.
See also
Structure, Organism, Body, Joint

Definition at line 84 of file Structure.h.

Constructor & Destructor Documentation

AnimatSim::Environment::Structure::Structure ( )

Default constructor.

Author
dcofer
Date
2/25/2011

Definition at line 53 of file Structure.cpp.

References m_fltSize, m_lpBody, AnimatSim::Environment::MovableItem::m_lpPhysicsMovableItem, m_lpScript, and AnimatSim::AnimatBase::m_lpSim.

AnimatSim::Environment::Structure::~Structure ( )
virtual

Destructor.

Author
dcofer
Date
2/25/2011

Definition at line 68 of file Structure.cpp.

References m_aryExcludeCollisionList, m_aryJoints, m_aryRigidBodies, m_lpBody, m_lpScript, and StdUtils::Std_TraceMsg().

+ Here is the call graph for this function:

Member Function Documentation

void AnimatSim::Environment::Structure::AddCollisionPair ( std::string  strID1,
std::string  strID2 
)
virtual

Adds a collision pair to m_aryExcludeCollisionList.

Author
dcofer
Date
2/25/2011
Parameters
strID1GUID ID of the first rigid body in the pair.
strID2GUID ID of the second rigid body in the pair.

Definition at line 914 of file Structure.cpp.

References m_aryExcludeCollisionList, AnimatSim::Environment::CollisionPair::m_strPart1ID, and AnimatSim::Environment::CollisionPair::m_strPart2ID.

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

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 578 of file Structure.cpp.

References AddRoot(), AddScript(), and StdUtils::Std_CheckString().

Referenced by AnimatSim::Environment::Organism::AddItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::AddJoint ( Joint lpJoint)

Adds a new joint to the list of all joints for this structure.

There are two reasons for this method. The first is to get a list of references to all joints in this structure that is mapped to their ID value. This allows us to use the STL find funtions to find joints. This is more efficeient that using a loop and recursion. The second reason is that this also allows us to ensure that each joint that is being added has a unique ID value. If you attempt to add a joint that has a ID that is already in the list then an exception will be thrown. Note that this method is NOT creating the object itself, that is done elsewhere. It is simply adding a reference to that created object to the list. Also, items in that list are not destroyed when the list is destroyed. It is a list of references only.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]lpJointpointer to a joint.

Definition at line 344 of file Structure.cpp.

References AnimatSim::AnimatBase::ID(), m_aryJoints, StdUtils::CStdErrorInfo::m_lError, StdUtils::CStdErrorInfo::m_strError, AnimatSim::AnimatBase::m_strName, and AnimatSim::AnimatBase::Name().

Referenced by AnimatSim::Environment::RigidBody::LoadJoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::AddRigidBody ( RigidBody lpBody)

Adds a new rigid body to the list of all bodies for this structure.

There are two reasons for this method. The first is to get a list of references to all rigid bodies in this structure that is mapped to their ID value. This allows us to use the STL find funtions to find bodies. This is more efficeient that using a loop and recursion. The second reason is that this also allows us to ensure that each body that is being added has a unique ID value. If you attempt to add a body that has a ID that is already in the list then an exception will be thrown. Note that this method is NOT creating the object itself, that is done elsewhere. It is simply adding a reference to that created object to the list. Also, items in that list are not destroyed when the list is destroyed. It is a list of references only.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]lpBodyThe pointer to a body.

Definition at line 400 of file Structure.cpp.

References AnimatSim::AnimatBase::ID(), m_aryRigidBodies, StdUtils::CStdErrorInfo::m_lError, StdUtils::CStdErrorInfo::m_strError, AnimatSim::AnimatBase::m_strName, and AnimatSim::AnimatBase::Name().

Referenced by AnimatSim::Environment::RigidBody::LoadRigidBody(), and LoadRoot().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::AddRoot ( std::string  strXml)
protectedvirtual

Creates and adds a root body part.

This method is primarily used by the GUI to add a new root body to the structure. It creates the root from info in the XML packet and then uses the XML to load in the new body part. It then initializes it and calls CreateParts, and CreateJoints.

Author
dcofer
Date
2/25/2011
Parameters
strXmlThe xml configuration data packet.

Definition at line 636 of file Structure.cpp.

References AnimatSim::Environment::RigidBody::CreateJoints(), AnimatSim::Environment::RigidBody::CreateParts(), StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), AnimatSim::AnimatBase::ID(), AnimatSim::Environment::BodyPart::Initialize(), LoadRoot(), m_lpBody, and AnimatSim::AnimatBase::m_lpSim.

Referenced by AddItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::AddScript ( std::string  strXml)
protectedvirtual

Creates and adds a scripting object to this structure.

This method is primarily used by the GUI to add a new script objects to the structure. It creates the ScriptProcessor from info in the XML packet and then uses the XML to load in the new script.

Author
dcofer
Date
5/23/2014
Parameters
strXmlThe xml configuration data packet.

Definition at line 696 of file Structure.cpp.

References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), AnimatSim::AnimatBase::Initialize(), LoadScript(), and m_lpScript.

Referenced by AddItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool AnimatSim::Environment::Structure::AllowRotateDragX ( )
virtual

Gets whether this body part can be rotated along the x-axis by the user with the drag handlers.

Author
dcofer
Date
4/21/2011
Returns
true if can rotate along x-axis.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 175 of file Structure.cpp.

bool AnimatSim::Environment::Structure::AllowRotateDragY ( )
virtual

Gets whether this body part can be rotated along the y-axis by the user with the drag handlers.

Author
dcofer
Date
4/21/2011
Returns
true if can rotate along y-axis.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 177 of file Structure.cpp.

bool AnimatSim::Environment::Structure::AllowRotateDragZ ( )
virtual

Gets whether this body part can be rotated along the z-axis by the user with the drag handlers.

Author
dcofer
Date
4/21/2011
Returns
true if can rotate along z-axis.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 179 of file Structure.cpp.

bool AnimatSim::Environment::Structure::AllowTranslateDragX ( )
virtual

Gets whether this body part can be translated along the x-axis by the user with the drag handlers.

Author
dcofer
Date
4/21/2011
Returns
true if can drag along x-axis.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 169 of file Structure.cpp.

bool AnimatSim::Environment::Structure::AllowTranslateDragY ( )
virtual

Gets whether this body part can be translated along the y-axis by the user with the drag handlers.

Author
dcofer
Date
4/21/2011
Returns
true if can drag along y-axis.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 171 of file Structure.cpp.

bool AnimatSim::Environment::Structure::AllowTranslateDragZ ( )
virtual

Gets whether this body part can be translated along the z-axis by the user with the drag handlers.

Author
dcofer
Date
4/21/2011
Returns
true if can drag along z-axis.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 173 of file Structure.cpp.

void AnimatSim::Environment::Structure::Body ( RigidBody lpBody)
virtual

Sets the root body.

Author
dcofer
Date
5/10/2011
Parameters
[in,out]lpBodyPointer to the root body.

Definition at line 103 of file Structure.cpp.

References m_lpBody.

Referenced by AnimatSim::Environment::RigidBody::IsRoot().

+ Here is the caller graph for this function:

RigidBody * AnimatSim::Environment::Structure::Body ( )
virtual

Gets the root body.

Gets the root body of the structure.

Author
dcofer
Date
2/25/2011
Returns
null if it fails, else.

Definition at line 115 of file Structure.cpp.

References m_lpBody.

Referenced by LoadRoot().

+ Here is the caller graph for this function:

long AnimatSim::Environment::Structure::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::AnimatBase.

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 850 of file Structure.cpp.

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

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::DisableCollision ( RigidBody lpCollisionBody)
virtual

Disables collision between the past-in object and all rigid bodies of this structure.

This method disables collision responses between the rigid body being past in and all rigid bodies in the structure.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]lpCollisionBodyThis is a pointer to the body to disable collisions on.

Definition at line 825 of file Structure.cpp.

References AnimatSim::Environment::RigidBody::DisableCollision(), and m_aryRigidBodies.

+ Here is the call graph for this function:

void AnimatSim::Environment::Structure::EnableCollision ( RigidBody lpCollisionBody)
virtual

Enables collision between the past-in object and all rigid bodies of this structure.

This method enables collision responses between the rigid body being past in and all rigid bodies in the structure.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]lpCollisionBodyhis is a pointer to the body to enable collisions on.

Definition at line 802 of file Structure.cpp.

References AnimatSim::Environment::RigidBody::EnableCollision(), and m_aryRigidBodies.

+ Here is the call graph for this function:

void AnimatSim::Environment::Structure::EnableMotor ( std::string  strJointID,
bool  bVal 
)
virtual

Enables the given joints motor.

Author
dcofer
Date
2/25/2011
Parameters
strJointIDGUID ID of the joint.
bValEnable/disable value.

Definition at line 760 of file Structure.cpp.

References AnimatSim::Environment::MotorizedJoint::EnableMotor(), and FindJoint().

+ Here is the call graph for this function:

CStdPtrArray< CollisionPair > AnimatSim::Environment::Structure::ExclusionList ( )
virtual

Gets the collision exclusion list as an array.

The collision exclusion list in an array of CollisionPair objects. Collisions between the two objects in the pair are disabled during the simulation. This allows the user to manually configure instances where rigid bodies should not have collisions between them. This is often important in making a stable and fast simulation. For instance, if you have items that may hit each other often and bind within a given structure you should disable the collisions between them to prevent this from occuring.

Author
dcofer
Date
2/25/2011
Returns
Array of CollisionPair objects that will be excluded from collisions.

Definition at line 210 of file Structure.cpp.

References m_aryExcludeCollisionList.

Joint * AnimatSim::Environment::Structure::FindJoint ( std::string  strJointID,
bool  bThrowError = true 
)
virtual

Finds a joint with a specified ID within this structure.

This function searches the list of joints associated with this structure to find one that matches the ID in a case-insensitive manner. If it finds it then it returns a pointer to that joint. If it does not find it then it will either throw an exception or return NULL based on the bThrowError parameter.

Author
dcofer
Date
2/25/2011
Parameters
strJointIDID of the joint to find. This is not case sensitive.
bThrowErrorIf this is true and the ID is not found then an exception is thrown. If this is false and the ID is not found then NULL is returned.
Returns
null if it fails and bThrowError is false, else the pointer to the found joint.

Definition at line 457 of file Structure.cpp.

References m_aryJoints, AnimatSim::AnimatBase::m_strName, and StdUtils::Std_CheckString().

Referenced by EnableMotor(), AnimatSim::Simulator::FindJoint(), FindNode(), and SetMotorInput().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Node * AnimatSim::Environment::Structure::FindNode ( std::string  strID,
bool  bThrowError = true 
)
virtual

Searches for a Node with the given ID.

Author
dcofer
Date
2/25/2011
Parameters
strIDGUID string ID of the Node..
bThrowErrortrue to throw error if not found.
Returns
null if it fails and bThrowError=false, else the found node.

Definition at line 515 of file Structure.cpp.

References FindJoint(), FindRigidBody(), and AnimatSim::AnimatBase::m_strName.

+ Here is the call graph for this function:

RigidBody * AnimatSim::Environment::Structure::FindRigidBody ( std::string  strBodyID,
bool  bThrowError = true 
)
virtual

Finds a rigid body with a specified ID within this structure.

This function searches the list of rigid bodies associated with this structure to find one that matches the ID in a case-insensitive manner. If it finds it then it returns a pointer to that body. If it does not find it then it will either throw an exception or return NULL based on the bThrowError parameter.

Author
dcofer
Date
2/25/2011
Parameters
strBodyIDID of the body to find. This is not case sensitive.
bThrowErrorIf this is true and the ID is not found then an exception is thrown. If this is false and the ID is not found then NULL is returned.
Returns
null if it fails and bThrowError is false, else the pointer to the found rigid body.

Definition at line 489 of file Structure.cpp.

References m_aryRigidBodies, AnimatSim::AnimatBase::m_strName, and StdUtils::Std_CheckString().

Referenced by FindNode(), AnimatSim::Simulator::FindRigidBody(), AnimatSim::ExternalStimuli::ForceStimulus::Initialize(), and AnimatSim::Environment::Bodies::LineBase::InitializeAttachments().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float * AnimatSim::Environment::Structure::GetDataPointer ( const std::string &  strDataType)
virtual

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

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

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

Reimplemented from AnimatSim::AnimatBase.

Definition at line 541 of file Structure.cpp.

References StdUtils::Std_CheckString().

+ Here is the call graph for this function:

void AnimatSim::Environment::Structure::Initialize ( )
virtual

Initializes this object.

After an object is loaded in it must be initialized before it can be used. This allows the object to retrieve any pointers or setup memory that it will need during execution. Each object is responsible for initializing any of its child objects, so you simply need to call this method on the containing class to init all child objects. It also calls VerifySystemPointers to make sure that the system pointers have been setup correctly.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 301 of file Structure.cpp.

References AnimatSim::AnimatBase::Initialize(), and m_lpScript.

Referenced by AnimatSim::Environment::Organism::Initialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 308 of file Structure.cpp.

References AnimatSim::AnimatBase::Kill(), and m_lpScript.

Referenced by AnimatSim::Environment::Organism::Kill().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::LoadCollisionPair ( CStdXml oXml)
protectedvirtual

Loads a collision pair.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]oXmlThe xml data packet to load.

Definition at line 931 of file Structure.cpp.

References StdUtils::CStdXml::GetChildString(), StdUtils::CStdXml::IntoElem(), m_aryExcludeCollisionList, AnimatSim::Environment::CollisionPair::m_strPart1ID, AnimatSim::Environment::CollisionPair::m_strPart2ID, and StdUtils::CStdXml::OutOfElem().

Referenced by LoadLayout().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 884 of file Structure.cpp.

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

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::LoadLayout ( CStdXml oXml)
protectedvirtual

Loads the layout for this structure from an asl configuration file.

This method opens up the Animat Structure Layout (ASL) file that was associated with this structure in the Animat Simulation (ASIM) file. Once it has loaded the file into a CStdXml object it then calls the second method to actually create the structure from the configuration file.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]oXmlThe xml data packet to load.

Definition at line 975 of file Structure.cpp.

References StdUtils::CStdXml::FindChildByIndex(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::GetChildFloat(), StdUtils::CStdXml::IntoElem(), LoadCollisionPair(), LoadRoot(), m_fltSize, m_lpBody, StdUtils::CStdXml::NumberOfChildren(), StdUtils::CStdXml::OutOfElem(), and Size().

+ Here is the call graph for this function:

RigidBody * AnimatSim::Environment::Structure::LoadRoot ( CStdXml oXml)
protectedvirtual

Loads the root rigid body.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]oXmlThe xml data packet to load.
Returns
The root.

Definition at line 1020 of file Structure.cpp.

References AddRigidBody(), Body(), AnimatSim::Simulator::CreateObject(), StdUtils::CStdXml::GetChildString(), StdUtils::CStdXml::IntoElem(), m_lpBody, AnimatSim::AnimatBase::m_lpSim, StdUtils::CStdXml::OutOfElem(), and AnimatSim::Environment::MovableItem::Parent().

Referenced by AddRoot(), and LoadLayout().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ScriptProcessor * AnimatSim::Environment::Structure::LoadScript ( CStdXml oXml)
protectedvirtual

Loads the script.

Author
dcofer
Date
5/23/2014
Parameters
[in,out]oXmlThe xml data packet to load.
Returns
The script.

Definition at line 1072 of file Structure.cpp.

References AnimatSim::Simulator::CreateObject(), StdUtils::CStdXml::GetChildString(), StdUtils::CStdXml::IntoElem(), AnimatSim::AnimatBase::Load(), AnimatSim::AnimatBase::m_lpSim, StdUtils::CStdXml::OutOfElem(), and AnimatSim::AnimatBase::SetSystemPointers().

Referenced by AddScript().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CStdFPoint AnimatSim::Environment::Structure::Position ( )
virtual

Gets the local position. (m_oPosition)

Author
dcofer
Date
3/2/2011
Returns
returns m_oPosition.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 118 of file Structure.cpp.

References AnimatSim::Environment::MovableItem::Position().

Referenced by AnimatSim::Environment::RigidBody::LoadPosition(), and AnimatSim::Environment::RigidBody::Position().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::Position ( CStdFPoint &  oPoint,
bool  bUseScaling = true,
bool  bFireChangeEvent = false,
bool  bUpdateMatrix = true 
)
virtual

Sets the local position. (m_oPosition)

Author
dcofer
Date
3/2/2011
Parameters
[in,out]oPointThe new point to use to set the local position.
bUseScalingIf true then the position values that are passed in will be scaled by the unit scaling values.
bFireChangeEventIf true then this will call the IMovableItemCallback->PositionChanged callback method to inform the GUI that the part has moved. If false then this callback will be skipped.
bUpdateMatrixIf true then the IPhysicsMovableItem->Physics_UpdateMatrix method will be called so that the osg graphics will be updated. If false then this will be skipped.

When we change the position of the structure we need to let the rigid body know that.

Reimplemented from AnimatSim::Environment::MovableItem.

Definition at line 120 of file Structure.cpp.

References AnimatSim::Environment::MovableItem::Callback(), m_lpBody, AnimatSim::Environment::MovableItem::PhysicsMovableItem(), AnimatSim::Environment::MovableItem::Position(), and AnimatSim::IMovableItemCallback::PositionChanged().

+ Here is the call graph for this function:

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

Definition at line 572 of file Structure.cpp.

References AnimatSim::AnimatBase::QueryProperties().

+ Here is the call graph for this function:

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

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 601 of file Structure.cpp.

References RemoveRoot(), RemoveScript(), and StdUtils::Std_CheckString().

Referenced by AnimatSim::Environment::Organism::RemoveItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::RemoveJoint ( std::string  strID)

Removes the joint with the specified ID.

Author
dcofer
Date
3/2/2011
Parameters
strIDID of the joint to remove
Exceptions
IfID is not found.

Definition at line 369 of file Structure.cpp.

References m_aryJoints, StdUtils::CStdErrorInfo::m_lError, StdUtils::CStdErrorInfo::m_strError, and AnimatSim::AnimatBase::m_strName.

void AnimatSim::Environment::Structure::RemoveRigidBody ( std::string  strID)

Removes the rigid body with the specified ID.

Author
dcofer
Date
3/2/2011
Parameters
strIDID of the body to remove
Exceptions
IfID is not found.

Definition at line 426 of file Structure.cpp.

References m_aryRigidBodies, StdUtils::CStdErrorInfo::m_lError, StdUtils::CStdErrorInfo::m_strError, and AnimatSim::AnimatBase::m_strName.

Referenced by AnimatSim::Environment::RigidBody::RemoveRigidBody().

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::RemoveRoot ( std::string  strID,
bool  bThrowError = true 
)
protectedvirtual

Removes the root based on ID.

This is primarily used by the GUI to remove the root from the structure when the user does this in the GUI.

Author
dcofer
Date
2/25/2011
Parameters
strIDGUI ID of the root to remove
bThrowErrorIf true then throw an error if there is a problem, otherwise return false
Returns
true if it succeeds, false if it fails.

Definition at line 670 of file Structure.cpp.

References AnimatSim::AnimatBase::ID(), m_lpBody, and AnimatSim::AnimatBase::m_lpSim.

Referenced by RemoveItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::RemoveScript ( std::string  strID,
bool  bThrowError = true 
)
protectedvirtual

Removes the script based on ID.

This is primarily used by the GUI to remove the script from the structure when the user does this in the GUI.

Author
dcofer
Date
5/23/2014
Parameters
strIDGUI ID of the script to remove
bThrowErrorIf true then throw an error if there is a problem, otherwise return false
Returns
true if it succeeds, false if it fails.

Definition at line 738 of file Structure.cpp.

References AnimatSim::AnimatBase::ID(), and m_lpScript.

Referenced by RemoveItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::ResetSimulation ( )
virtual
void AnimatSim::Environment::Structure::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::AnimatBase.

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 867 of file Structure.cpp.

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

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::Selected ( bool  bValue,
bool  bSelectMultiple 
)
virtual

Selects this object.

Selects or deselects this object. If selectmultiple is true and bValue is true then it will try and add this item to a group of selected items. If selectmultiple is false then the currently selected item will be deselected and this one will be selected. All of this selection logic is actually taking place in the GUI. All the simulation does is have this variable that keeps track of whether THIS item is selected or not. Determining if it should be part of a group or not is done in the GUI project workspace.

Author
dcofer
Date
2/22/2011
Parameters
bValuetrue to select, false to deselect.
bSelectMultipleIf true then this items is added as part of a group. If false then it is removed from a group.

Reimplemented from AnimatSim::AnimatBase.

Definition at line 162 of file Structure.cpp.

References AnimatSim::AnimatBase::Selected().

+ Here is the call graph for this function:

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

Reimplemented in AnimatSim::Environment::Organism.

Definition at line 555 of file Structure.cpp.

References AnimatSim::AnimatBase::SetData(), and StdUtils::Std_CheckString().

Referenced by AnimatSim::Environment::Organism::SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::SetMotorInput ( std::string  strJointID,
float  fltInput 
)
virtual

Sets the velocity for the specified joint.

This method attempts to locate a joint within a structure and set its velocity. The velocity will only have any effect if the motor for that joint has been enabled.

Author
dcofer
Date
2/25/2011
Parameters
strJointIDThe ID of the joint.
fltInputThe velocity to set this joint to use.

Definition at line 782 of file Structure.cpp.

References FindJoint(), and AnimatSim::Environment::MotorizedJoint::MotorInput().

+ Here is the call graph for this function:

void AnimatSim::Environment::Structure::Sim ( Simulator lpSim)

Sets the simulator object.

Author
dcofer
Date
2/25/2011
Parameters
[in,out]lpSimThe pointer to a simulation.

Definition at line 91 of file Structure.cpp.

References AnimatSim::AnimatBase::m_lpSim.

void AnimatSim::Environment::Structure::SimPausing ( )
virtual

Called just before the simulation pauses.

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

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Definition at line 318 of file Structure.cpp.

void AnimatSim::Environment::Structure::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 314 of file Structure.cpp.

void AnimatSim::Environment::Structure::SimStopping ( )
virtual

Called just before the simulation stops.

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

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Definition at line 322 of file Structure.cpp.

float AnimatSim::Environment::Structure::Size ( )
virtual

Gets the size of the graphical representation of this joint.

Author
dcofer
Date
3/22/2011
Returns
Size for the graphics object.

Definition at line 142 of file Structure.cpp.

References m_fltSize.

Referenced by LoadLayout().

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::Size ( float  fltVal,
bool  bUseScaling = true 
)
virtual

Sets the size of the graphical representation of this joint.

Author
dcofer
Date
3/22/2011
Parameters
fltValThe new size value.
bUseScalingtrue to use unit scaling.

Definition at line 153 of file Structure.cpp.

References AnimatSim::Simulator::InverseDistanceUnits(), m_fltSize, AnimatSim::AnimatBase::m_lpSim, and StdUtils::Std_IsAboveMin().

+ Here is the call graph for this function:

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

Definition at line 286 of file Structure.cpp.

References m_lpBody, m_lpScript, AnimatSim::Environment::RigidBody::StepSimulation(), and UpdateData().

Referenced by AnimatSim::Environment::Organism::StepPhysicsEngine(), and AnimatSim::Simulator::StepPhysicsEngine().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AnimatSim::Environment::Structure::UpdateData ( )
protectedvirtual

Collects reporting data for the structure at each time step.

This is called during StepSimulation of the structure so that we can collect or setup any data that needs to be reported back to other systems. An example of this is setting the ReportPosition and ReportRotation values.

Author
dcofer
Date
2/25/2011

Definition at line 223 of file Structure.cpp.

References AnimatSim::Environment::MovableItem::m_lpPhysicsMovableItem.

Referenced by ResetSimulation(), and StepPhysicsEngine().

+ Here is the caller graph for this function:

Member Data Documentation

CStdMap<std::string, Joint *> AnimatSim::Environment::Structure::m_aryJoints
protected

A list of joints contained within this structure. The objects in this list are references only. They are not destroyed by this list. It is used primarily for finding joints and ensuring that only unique ID's are used for the joints.

Definition at line 102 of file Structure.h.

Referenced by AddJoint(), FindJoint(), RemoveJoint(), and ~Structure().

CStdMap<std::string, RigidBody *> AnimatSim::Environment::Structure::m_aryRigidBodies
protected

A list of rigid bodies contained within this structure. The objects in this list are references only. They are not destroyed by this list. It is used primarily for finding rigid bodies and ensuring that only unique ID's are used for the rigid bodies.

Definition at line 95 of file Structure.h.

Referenced by AddRigidBody(), DisableCollision(), EnableCollision(), FindRigidBody(), RemoveRigidBody(), and ~Structure().

IMovableItemCallback* AnimatSim::Environment::Structure::m_lpCallback
protected

This is a pointer to an instance of the IMovableItemCallback interface. This interface is used to send back information to the GUI. If you are running in simulation mode only then this will be NULL and no info will be sent back up. If you are running with the GUI then it makes the calls back up to it.

Definition at line 111 of file Structure.h.


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