2 #include "IMovableItemCallback.h"
3 #include "ISimGUICallback.h"
4 #include "IMotorizedJoint.h"
9 #include "IPhysicsMovableItem.h"
10 #include "IPhysicsBody.h"
13 #include "MovableItem.h"
38 #include "RemoteControlLinkage.h"
39 #include "RemoteControl.h"
47 void RemoteControlData::ClearStartStops()
49 if((fabs(m_fltStart) > 0 || fabs(m_fltStop) > 0))
68 void RemoteControlData::CheckStartedStopped()
70 if(m_fltValue == m_fltPrev)
77 if(!m_bStarted && m_fltValue != 0)
80 m_fltStart = 1*m_iStartDir;
85 else if(m_bStarted && m_fltValue == 0)
87 m_fltStop = m_iStartDir;
96 m_fltPrev = m_fltValue;
106 RemoteControlLinkage::RemoteControlLinkage(
void)
119 RemoteControlLinkage::~RemoteControlLinkage(
void)
129 {
Std_TraceMsg(0,
"Caught Error in desctructor of RemoteControlLinkage\r\n",
"", -1,
false,
true);}
233 int RemoteControlLinkage::PropertyID() {
return m_iPropertyID;}
235 void RemoteControlLinkage::PropertyID(
int iID,
bool bCreateDataTypes)
267 int iLen = strProp.length();
268 if(((iLen-5) >= 0) && strProp.substr(strProp.length() - 5, 5) ==
"START")
270 else if(((iLen-4) >= 0) && strProp.substr(strProp.length() - 4, 4) ==
"STOP")
307 void RemoteControlLinkage::AppliedValue(
float fltVal) {
m_fltAppliedValue = fltVal;}
309 #pragma region DataAccesMethods
315 if(strType ==
"APPLIEDCURRENT" || strType ==
"APPLIEDVALUE")
318 THROW_TEXT_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Robot Interface ID: " + STR(
m_strName) +
" DataType: " + strDataType);
330 if(strType ==
"ENABLED")
335 else if(strType ==
"SOURCEDATATYPEID")
340 else if(strType ==
"TARGETDATATYPEID")
345 else if(strType ==
"SOURCEID")
350 else if(strType ==
"TARGETID")
355 else if(strType ==
"PROPERTYNAME")
360 else if(strType ==
"PROPERTYID")
362 PropertyID(atoi(strValue.c_str()));
368 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
377 aryProperties.Add(
new TypeProperty(
"Enabled", AnimatPropertyType::Boolean, AnimatPropertyDirection::Both));
378 aryProperties.Add(
new TypeProperty(
"SourceDataTypeID", AnimatPropertyType::String, AnimatPropertyDirection::Set));
379 aryProperties.Add(
new TypeProperty(
"TargetDataTypeID", AnimatPropertyType::String, AnimatPropertyDirection::Set));
380 aryProperties.Add(
new TypeProperty(
"SourceID", AnimatPropertyType::String, AnimatPropertyDirection::Set));
381 aryProperties.Add(
new TypeProperty(
"TargetID", AnimatPropertyType::String, AnimatPropertyDirection::Set));
382 aryProperties.Add(
new TypeProperty(
"PropertyName", AnimatPropertyType::String, AnimatPropertyDirection::Set));
383 aryProperties.Add(
new TypeProperty(
"PropertyID", AnimatPropertyType::Integer, AnimatPropertyDirection::Set));
384 aryProperties.Add(
new TypeProperty(
"AppliedValue", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
434 THROW_PARAM_ERROR(Al_Err_lNodeNotFound, Al_Err_strNodeNotFound,
"ID: ",
m_strSourceID);
452 THROW_PARAM_ERROR(Al_Err_lNodeNotFound, Al_Err_strNodeNotFound,
"ID: ",
m_strTargetID);
467 void RemoteControlLinkage::ApplyValue(
float fltData)
483 m_fltAppliedValue = CalculateAppliedValue(fltData);
506 void RemoteControlLinkage::Load(
CStdXml &oXml)
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
std::string m_strSourceDataTypeID
ID of the source data type. This is only used during loading.
Base class file for all Animat simulation objects.
Declares the nervous system class.
Declares the simulation recorder class.
Declares the Robot IO control interface base class.
Root namespace for the base simulation library for AnimatLab.
RemoteControlData m_Data
This is a set of data that is associated with this linkage.
Declares the body part class.
AnimatBase * m_lpSource
Source object we are inserting from.
virtual std::string TargetID()
Gets the target ID.
Simulator * m_lpSim
The pointer to a Simulation.
float * m_lpTargetData
Pointer to the external value of the linked target.
std::string m_strProperty
The array index of this button.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
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 void StepSimulation()
Step the simulation for this object.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
Class that stores information about types for QueryProperty information.
Declares the link base class.
Declares the key frame class.
int Std_Sign(float fltVal)
Determines the sign of a number.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Declares the joint class.
Declares the organism class.
virtual int GetChildInt(std::string strElementName)
Gets an integer value from the element with the specified name.
virtual std::string SourceDataTypeID()
Gets the target data type.
int m_iTargetDataType
integer index of the target data type
Declares the activated item class.
Declares a light manager object.
AnimatBase * m_lpTarget
Target object we are inserting into.
Declares the bounding box class.
Declares the gain base 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 standard xml manipulation class.
virtual std::string SourceID()
Gets the source ID.
std::string m_strPropertyName
Name of the property that will be used for the data type if required.
virtual std::string TargetDataTypeID()
Gets the target data type.
std::string m_strSourceID
ID of the source. This is only used during loading.
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.
int m_iChangeSimStepCount
The number of simulation time slices to keep a start/stop signal active.
virtual void StepIO()
This method is called from within the IO thread. It calls StepIO for each part.
virtual AnimatBase * FindByID(std::string strID, bool bThrowError=true)
Searches for the object with the specified ID.
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.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
float m_fltAppliedValue
The total value applied during a time step.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual void SetupIO()
This method is called after all connections to whatever control board have been made. It calls each parts SetupIO method. For example, We connect to a Firmata microcontroller like an Arduino, and then do a setup that could take some time. We should not attempt to setup any of the pins until after the board itself has been setup. After that we need to loop through and setup all the parts.
float * m_lpSourceData
Pointer to the source data variable.
virtual void Initialize()
Initializes this object.
bool Std_IsBlank(std::string strVal)
Trims a string and tests if a string is blank.
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.
std::string m_strTargetDataTypeID
ID of the target data type. This is only used during loading.
Declares the structure class.
Declares the odor type class.
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 m_strTargetID
ID of the target. This is only used during loading.
Declares the robotics inerface for animatlab.
virtual std::string PropertyName()
Gets the property name.
RemoteControl * m_lpParentRemoteControl
Pointer tho the parent remote control.
Declares the simulator class.
Declares the neural module class.
virtual bool InLink()
Gets the inlink value.
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.
std::string m_strName
The name for this object.