AnimatLab  2
Test
RobotPartInterface.h
1 #pragma once
2 
3 namespace AnimatSim
4 {
5  namespace Robotics
6  {
7 
8  class ANIMAT_PORT RobotPartInterface : public AnimatBase
9  {
10  protected:
11  RobotInterface *m_lpParentInterface;
12  RobotIOControl *m_lpParentIOControl;
13 
14  BodyPart *m_lpPart;
15  std::string m_strPartID;
16 
17  float *m_lpProperty;
18  std::string m_strPropertyName;
19 
21  Gain *m_lpGain;
22 
26 
29  float m_fltIOValue;
30 
33 
37 
39  bool m_bChanged;
40 
41  //The time it takes to perform a step of the IO for this part.
42  float m_fltStepIODuration;
43 
44  virtual void AddGain(std::string strXml);
45 
46  public:
47  RobotPartInterface(void);
48  virtual ~RobotPartInterface(void);
49 
50  static RobotPartInterface *CastToDerived(AnimatBase *lpBase) {return static_cast<RobotPartInterface*>(lpBase);}
51 
52  virtual void ParentIOControl(RobotIOControl *lpParent);
53  virtual RobotIOControl *ParentIOControl();
54 
55  virtual int IOComponentID();
56  virtual void IOComponentID(int iID);
57 
58  virtual float IOValue();
59  virtual void IOValue(float fltVal);
60 
61  virtual int IOValueInt();
62  virtual void IOValueInt(int iVal);
63 
64  virtual float IOScaledValue();
65  virtual void IOScaledValue(float fltVal);
66 
67  virtual bool Changed();
68  virtual void Changed(bool bVal);
69 
70  virtual void LinkedPartID(std::string strID);
71  virtual std::string LinkedPartID();
72 
73  virtual void PropertyName(std::string strName);
74  virtual std::string PropertyName();
75 
76  virtual bool IsMotorControl();
77  virtual bool IncludeInPartsCycle() {return false;}
78 
79  virtual float QuantizeServoPosition(float fltPos);
80  virtual float QuantizeServoVelocity(float fltVel);
81 
82  virtual Gain *GetGain();
83  virtual void SetGain(Gain *lpGain);
84 
85  virtual float StepIODuration();
86 
87 #pragma region DataAccesMethods
88 
89  virtual float *GetDataPointer(const std::string &strDataType);
90  virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
91  virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
92 
93 #pragma endregion
94 
95  virtual void SetupIO();
96  virtual void StepIO(int iPartIdx);
97  virtual void ShutdownIO();
98 
99  virtual void Initialize();
100  virtual void ResetSimulation();
101  virtual void Load(CStdXml &oXml);
102  };
103 
104  }
105 }
Root namespace for the base simulation library for AnimatLab.
bool m_bChanged
True when the value changes.
A Robot IO controller base class.
Animat base class.
Definition: AnimatBase.h:36
Gain * m_lpGain
Pointer to the Gain that will be used to convert the source value into the target value...
int m_iIOValue
This stores the temporary IO value to be used later in IO calculations.
The Robotics interface configures a simulation to run on a microcontroller board. ...