8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
10 #include "IMotorizedJoint.h"
15 #include "IPhysicsMovableItem.h"
16 #include "IPhysicsBody.h"
18 #include "MovableItem.h"
43 #include "RobotPartInterface.h"
77 {
Std_TraceMsg(0,
"Caught Error in desctructor of RobotInterface\r\n",
"", -1,
false,
true);}
110 Std_IsAboveMin((
float) 0, fltStep,
true,
"PhysicsTimeStep",
false);
145 #pragma region DataAccesMethods
154 THROW_TEXT_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Robot Interface ID: " + STR(
m_strName) +
" DataType: " + strDataType);
163 if(strType ==
"ENABLED")
169 if(strType ==
"PHYSICSTIMESTEP")
175 if(strType ==
"SYNCHSIM")
186 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
201 if(strType ==
"ROBOTIOCONTROL")
209 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
218 if(strType ==
"ROBOTIOCONTROL")
226 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
294 for(
int iIndex=0; iIndex<iCount; iIndex++)
299 THROW_PARAM_ERROR(Al_Err_lIOControlIDNotFound, Al_Err_strIOControlIDNotFound,
"ID", strID);
313 for(
int iIndex=0; iIndex<iCount; iIndex++)
325 for(
int iIndex=0; iIndex<iCount; iIndex++)
337 for(
int iIndex=0; iIndex<iCount; iIndex++)
351 for(
int iIndex=0; iIndex<iCount; iIndex++)
356 void RobotInterface::Load(
CStdXml &oXml)
370 for(
int iIndex=0; iIndex<iChildCount; iIndex++)
406 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"RobotIOControl");
419 if(lpChild)
delete lpChild;
425 if(lpChild)
delete lpChild;
426 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
Base class file for all Animat simulation objects.
Declares the nervous system class.
CStdPtrArray< RobotIOControl > m_aryIOControls
Declares the simulation recorder class.
Declares the Robot IO control interface base class.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
virtual bool InSimulation()
Used to determine if we are running in a simulation, or in a real control mode.
Root namespace for the base simulation library for AnimatLab.
virtual ~RobotInterface(void)
Destructor.
virtual void Initialize()
Initializes this object.
Declares the body part class.
virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
Adds a new object to this parent.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
Information about the standard error.
virtual std::string ID()
Gets the unique GUID ID of this object.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
virtual float PhysicsTimeStep()
Gets the physics time step used within the robot framwork.
float m_fltPhysicsTimeStep
virtual void ParentInterface(RobotInterface *lpParent)
Sets the parent robot interface pointer.
virtual void Initialize()
Initializes this object.
Declares the link base class.
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
Declares the key frame class.
virtual RobotIOControl * AddIOControl(std::string strXml)
Creates and adds a robot IO control.
Declares the joint class.
Declares the organism class.
RobotInterface(void)
Default constructor.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
virtual void ShutdownIO()
This method is called just before the IO thread is closed down. It gives the IO objects a chance to d...
std::string Std_Trim(std::string strVal)
Trims a string.
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
Declares the activated item class.
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
Declares a light manager object.
virtual bool RobotAdpaterSynch()
Gets whether we need to synch the physics adapters in a simulation to the robot physics time step...
Declares the bounding box class.
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.
A Robot IO controller base class.
A standard xml manipulation class.
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
virtual void StepSimulation()
Step the simulation for this object.
virtual bool SynchSim()
Gets whether we need to delay stepping of the physics adapters in the simulation to more closely matc...
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
bool Std_ToBool(int iVal)
Converts a value toa bool.
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual bool GetChildBool(std::string strElementName)
Gets a bool value from the element with the specified name.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
virtual int NumberOfChildren()
Gets the number of children of the current element.
virtual RobotIOControl * LoadIOControl(CStdXml &oXml)
Loads a child IO Control.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual void Initialize()
Initializes this object.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Declares the data chart manager class.
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual void RemoveIOControl(std::string strID, bool bThrowError=true)
Removes the rigid body with the specified ID.
Declares the structure class.
Declares the odor type class.
virtual int FindChildListPos(std::string strID, bool bThrowError=true)
Finds the array index for the child part with the specified ID.
Declares the robotics inerface for animatlab.
Declares the simulator class.
Declares the neural module class.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
virtual CStdPtrArray< RobotIOControl > * IOControls()
Gets the array of IO controls.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
Declares the activated item manager class.
Declares the external stimuli manager class.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
Declares the receptive field class.
virtual void StepSimulation()
Step the simulation for this object.
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
std::string m_strName
The name for this object.
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.