8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
14 #include "IPhysicsMovableItem.h"
15 #include "IPhysicsBody.h"
17 #include "MovableItem.h"
40 #include "PidControl.h"
59 bool bComplexError,
bool bAntiResetWindup,
bool bRampLimit,
60 float fltRangeMax,
float fltRangeMin,
float fltARWBound,
float fltRampGradient) :
61 CStdPID(fltSetpoint, fltGain, fltIntegralAct, fltDerivativeAct, bComplexError, bAntiResetWindup,
62 bRampLimit, fltRangeMax, fltRangeMin, fltARWBound, fltRampGradient)
80 {
Std_TraceMsg(0,
"Caught Error in desctructor of PidControl\r\n",
"", -1,
false,
true);}
120 float *lpData = NULL;
122 if(strType ==
"ENABLE")
123 return &m_fltEnabled;
135 if(strType ==
"ENABLED")
143 Gain((
float) atof(strValue.c_str()));
149 IntegralAct((
float) atof(strValue.c_str()));
155 DerivativeAct((
float) atof(strValue.c_str()));
159 if(strType ==
"COMPLEXERROR")
165 if(strType ==
"ANTIRESETWINDUP")
171 if(strType ==
"RAMPLIMIT")
177 if(strType ==
"RANGEMAX")
179 RangeMax((
float) atof(strValue.c_str()));
183 if(strType ==
"RANGEMIN")
185 RangeMin((
float) atof(strValue.c_str()));
189 if(strType ==
"ARWBOUND")
191 ARWBound((
float) atof(strValue.c_str()));
195 if(strType ==
"RAMPGRADIENT")
197 RampGradient((
float) atof(strValue.c_str()));
203 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Data Type", strDataType);
212 aryProperties.Add(
new TypeProperty(
"Enable", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
214 aryProperties.Add(
new TypeProperty(
"Enabled", AnimatPropertyType::Boolean, AnimatPropertyDirection::Both));
215 aryProperties.Add(
new TypeProperty(
"Kp", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
216 aryProperties.Add(
new TypeProperty(
"Ki", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
217 aryProperties.Add(
new TypeProperty(
"Kd", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
218 aryProperties.Add(
new TypeProperty(
"ComplexError", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
219 aryProperties.Add(
new TypeProperty(
"AntiResetWindup", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
220 aryProperties.Add(
new TypeProperty(
"RampLimit", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
221 aryProperties.Add(
new TypeProperty(
"RangeMax", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
222 aryProperties.Add(
new TypeProperty(
"RangeMin", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
223 aryProperties.Add(
new TypeProperty(
"ARWBound", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
224 aryProperties.Add(
new TypeProperty(
"RampGradient", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
232 void PidControl::Load(
CStdXml &oXml)
243 ComplexError(oXml.
GetChildBool(
"ComplexError", m_bComplexError));
244 AntiResetWindup(oXml.
GetChildBool(
"AntiResetWindup", m_bAntiResetWindup));
245 RampLimit(oXml.
GetChildBool(
"RampLimit", m_bRampLimit));
249 RampGradient(oXml.
GetChildFloat(
"RampGradient", m_fltRampGradient));
Base class file for all Animat simulation objects.
Declares the nervous system class.
Declares the simulation recorder class.
Root namespace for the base simulation library for AnimatLab.
Declares the body part class.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Simulator * m_lpSim
The pointer to a Simulation.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
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.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
bool m_bInitEnabled
Keeps track of the enabled state at sim startup.
Declares the link base class.
Declares the key frame class.
Declares the joint class.
Declares the organism class.
virtual bool SimRunning()
Gets whether the simulation is running.
Declares the activated item class.
PidControl()
Default constructor.
Implements a basic PID control algorithm.
Declares a light manager object.
Declares the bounding box class.
Declares the gain 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 QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
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 bool Enabled()
Tells whether this node is enabled.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
virtual ~PidControl()
Destructor.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
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.
Declares the structure class.
Declares the odor type class.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
Declares the simulator class.
Declares the neural module class.
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 float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.