11 #include "IPhysicsMovableItem.h"
12 #include "IPhysicsBody.h"
13 #include "ISimGUICallback.h"
15 #include "MovableItem.h"
77 if(fabs(fltVal -
m_fltLimitPos) < 1e-5 && !bOverrideSameCheck)
92 Std_IsAboveMin((
float) 0, fltVal,
true,
"Constraint::Damping",
true);
105 Std_IsAboveMin((
float) 0, fltVal,
true,
"Constraint::Restitution",
true);
114 Std_IsAboveMin((
float) 0, fltVal,
true,
"Constraint::Stiffness",
true);
251 SetSystemPointers(lpSim, lpStructure, lpModule, lpNode, bVerify);
260 THROW_PARAM_ERROR(Al_Err_lStructureNotDefined, Al_Err_strStructureNotDefined,
"ConstraintLimit: ",
m_strName);
263 THROW_PARAM_ERROR(Al_Err_lJointNotDefined, Al_Err_strJointNotDefined,
"ConstraintLimit: ",
m_strName);
266 #pragma region DataAccesMethods
272 if(strType ==
"LIMITPOS")
275 THROW_TEXT_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"JointID: " + STR(
m_strName) +
" DataType: " + strDataType);
287 if(strType ==
"LIMITPOS")
289 LimitPos((
float) atof(strValue.c_str()));
292 else if(strType ==
"DAMPING")
294 Damping((
float) atof(strValue.c_str()));
297 else if(strType ==
"RESTITUTION")
302 else if(strType ==
"STIFFNESS")
304 Stiffness((
float) atof(strValue.c_str()));
307 else if(strType ==
"COLOR")
312 else if(strType ==
"ALPHA")
314 Alpha((
float) atof(strValue.c_str()));
320 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
329 aryProperties.Add(
new TypeProperty(
"LimitPos", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
330 aryProperties.Add(
new TypeProperty(
"Damping", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
331 aryProperties.Add(
new TypeProperty(
"Restitution", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
332 aryProperties.Add(
new TypeProperty(
"Stiffness", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
333 aryProperties.Add(
new TypeProperty(
"Color", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
334 aryProperties.Add(
new TypeProperty(
"Alpha", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
348 void ConstraintLimit::Load(
CStdXml &oXml, std::string strName)
ConstraintLimit()
Default constructor.
The base class for all of the joint type of objects.
Base class file for all Animat simulation objects.
float m_fltLimitPos
The limit position for the constraint. This can be in radians or meters depending on the type of join...
virtual bool IsShowPosition()
Gets whether this contstraint is actually just being used to show the current position of the joint...
Declares the simulation recorder class.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
Simulates the entire environment.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
Root namespace for the base simulation library for AnimatLab.
void Set(float R, float G, float B, float A)
Sets the color values.
virtual float InverseMassUnits()
Gets the inverse mass units.
virtual float LimitPos()
Gets the limit position.
Declares the body part class.
float m_fltRestitution
The restitution coefficient for the constraint.
virtual float Restitution()
Gets the restitution coefficient of the constraint.
void Load(CStdXml &oXml, std::string strParamName, bool bThrowError=true)
Loads the color.
Simulator * m_lpSim
The pointer to a Simulation.
virtual bool IsLowerLimit()
Query if this object is lower limit.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Class that stores information about types for QueryProperty information.
virtual float Stiffness()
Gets the stiffness of the constraint.
Declares the key frame class.
virtual float Alpha()
Gets the alpha value.
Declares the joint class.
Declares the organism class.
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...
Joint * m_lpJoint
Pointer to parent joint.
Declares the activated item class.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
virtual float Damping()
Gets the damping value of the contraint.
Declares a light manager object.
float m_fltDamping
The damping for the constraint.
Declares the bounding box class.
A standard xml manipulation 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.
A "static" structure in the simulation.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
virtual void SetLimitValues()=0
Sets the limit values of the joint in the child object.
float m_fltStiffness
The stiffness of the constraint.
virtual void SetLimitPos()=0
Sets the limit position using the current value set within the object.
Base class for body parts and neural network nodes.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual CStdColor * Color()
Gets the color that is used when displaying this constraint.
Declares the data chart manager class.
bool m_bIsLowerLimit
If true then this is the lower limit of a pair of ConstraintLimits, else it is the upper limit...
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
Declares the constraint limit class.
Declares the structure class.
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
Declares the odor type class.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
virtual bool UsesRadians()
Tells whether this joint uses radians or meters for its measurements.
virtual float InverseDistanceUnits()
Gets the inverse distance units.
Declares the simulator class.
Declares the activated item manager class.
Declares the external stimuli manager class.
CStdColor m_vColor
The color used to display the limit.
virtual ~ConstraintLimit()
Destructor.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
void a(float fltA, bool bThrowError=true)
Sets the alpha value of the color.
Declares the receptive field class.
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.