8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
13 #include "IPhysicsMovableItem.h"
14 #include "IPhysicsBody.h"
16 #include "MovableItem.h"
56 for(
int iIdx=0; iIdx<6; iIdx++)
82 {
Std_TraceMsg(0,
"Caught Error in desctructor of Joint\r\n",
"", -1,
false,
true);}
584 void Joint::WakeDynamics()
609 for(
int iIdx=0; iIdx<6; iIdx++)
623 float *Joint::GetDataPointer(
const std::string &strDataType)
627 float *lpData = NULL;
629 if(strType ==
"ENABLE")
634 float *lpData = NULL;
636 if(lpData)
return lpData;
639 return BodyPart::GetDataPointer(strDataType);
642 bool Joint::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
646 if(BodyPart::SetData(strType, strValue,
false))
649 if(strType ==
"ENABLELIMITS")
655 if(strType ==
"SIZE")
657 Size((
float) atof(strValue.c_str()));
661 if(strType ==
"RELAXATION1")
666 if(strType ==
"RELAXATION2")
671 if(strType ==
"RELAXATION3")
676 if(strType ==
"RELAXATION4")
681 if(strType ==
"RELAXATION5")
686 if(strType ==
"RELAXATION6")
691 if(strType ==
"FRICTION")
698 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
703 void Joint::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
705 BodyPart::QueryProperties(aryProperties);
707 aryProperties.Add(
new TypeProperty(
"Enable", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
709 aryProperties.Add(
new TypeProperty(
"EnableLimits", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
710 aryProperties.Add(
new TypeProperty(
"Size", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
711 aryProperties.Add(
new TypeProperty(
"Relaxation1", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
712 aryProperties.Add(
new TypeProperty(
"Relaxation2", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
713 aryProperties.Add(
new TypeProperty(
"Relaxation3", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
714 aryProperties.Add(
new TypeProperty(
"Relaxation4", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
715 aryProperties.Add(
new TypeProperty(
"Relaxation5", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
716 aryProperties.Add(
new TypeProperty(
"Relaxation6", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
717 aryProperties.Add(
new TypeProperty(
"Friction", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
742 UpdateAbsolutePosition();
753 for(
int iIdx=0; iIdx<6; iIdx++)
761 void Joint::Load(
CStdXml &oXml)
763 BodyPart::Load(oXml);
768 THROW_PARAM_ERROR(Al_Err_lParentNotDefined, Al_Err_strParentNotDefined,
"JointID",
m_strName);
771 THROW_PARAM_ERROR(Al_Err_lChildNotDefined, Al_Err_strChildNotDefined,
"JointID",
m_strName);
823 std::string strModule;
835 if(!lpConstraintRelaxation)
836 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"ConstraintRelaxation");
839 lpConstraintRelaxation->Load(oXml);
841 return lpConstraintRelaxation;
845 if(lpConstraintRelaxation)
delete lpConstraintRelaxation;
851 if(lpConstraintRelaxation)
delete lpConstraintRelaxation;
852 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
873 std::string strModule;
885 if(!lpConstraintFriction)
886 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"ConstraintFriction");
889 lpConstraintFriction->Load(oXml);
891 return lpConstraintFriction;
895 if(lpConstraintFriction)
delete lpConstraintFriction;
901 if(lpConstraintFriction)
delete lpConstraintFriction;
902 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Base class file for all Animat simulation objects.
virtual void Initialize()
Initializes this object.
Declares the simulation recorder 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.
Root namespace for the base simulation library for AnimatLab.
AnimatSim::Behavior::NeuralModule * m_lpModule
The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NU...
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
virtual ConstraintRelaxation * Relaxation5()
Gets the pointer to the thirdary axis rotation relaxation.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual void UpdateData()
Called to collect any body data for this part.
Declares the body part class.
virtual float GetLimitRange()
Gets the entire range of movement within the limits. If limits are not enabled then it returns -1...
virtual void UpdatePhysicsPosFromGraphics()
Updates the physics position from graphics.
virtual float JointForce()
Gets the joint force.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
float m_fltEnabled
This is used for reporting the enabled state in a GetDataPointer call.
virtual ConstraintRelaxation * Relaxation3()
Gets the pointer to the secondary axis displacement relaxation.
Information about the standard error.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
ConstraintFriction * m_lpFriction
The friction for this joint.
Class that stores information about types for QueryProperty information.
virtual void Initialize()
Initializes this object.
Declares the key frame class.
virtual float GetPositionWithinLimits(float fltPos)
Gets a position value within the constraint limits.
virtual void Initialize()
Initializes this object.
Declares the joint class.
Declares the organism class.
virtual float Size()
Gets the size of the graphical representation of this joint.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
virtual ConstraintRelaxation * Relaxation2()
Gets the pointer to the secondary axis displacement relaxation.
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 ClearRelaxations()
Clears the relaxation pointers.
virtual void CreateJoint()
Creates the joint.
Joint()
Default constructor.
virtual void Resize()
Called when this object has been resized.
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 RigidBody * Child()
Gets the child RigidBody part for this joint.
IPhysicsMovableItem * m_lpPhysicsMovableItem
Declares the bounding box class.
A standard xml manipulation class.
virtual void StepSimulation()
Step the simulation for this object.
virtual int VisualSelectionType()
Gets the visual selection type for this part.
virtual float JointVelocity()
Gets the joint velocity.
RigidBody * m_lpChild
The child rigid body for this joint.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
virtual ConstraintRelaxation * LoadConstraintRelaxation(CStdXml &oXml, std::string strName)
Loads constraint relaxation object.
bool m_bEnableLimits
If true then any ConstraintLimits for this joint are enabled.
bool Std_ToBool(int iVal)
Converts a value toa bool.
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.
float m_fltForce
The current force being applied to the joint by the motor.
virtual ConstraintRelaxation * Relaxation1()
Gets the pointer to the primary axis displacement relaxation.
virtual ConstraintFriction * Friction()
Gets the pointer to the friction.
virtual ConstraintRelaxation * Relaxation4()
Gets the pointer to the secondary axis rotation relaxation.
float m_fltSize
Scales the size of the graphics for this joint.
virtual ConstraintFriction * LoadConstraintFriction(CStdXml &oXml)
Loads constraint Friction object.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual void StepSimulation()
Step the simulation for this object.
virtual float JointPosition()
Gets the joint position.
Declares the data chart manager class.
virtual ConstraintRelaxation * Relaxation6()
Gets the pointer to the thirdary axis rotation relaxation.
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
Declares the structure class.
Declares the odor type class.
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.
virtual bool EnableLimits()
Tells if ConstraintLimits are enabled.
Declares the activated item manager class.
Declares the external stimuli manager class.
virtual ~Joint()
Destructor.
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)
Adds an external node input.
The base class for all of the basic rigid body type of objects.
Declares the receptive field class.
ConstraintRelaxation * m_aryRelaxations[6]
The relaxations for the constraints.
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.