AnimatLab  2
Test
ContactSensor.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 
10 namespace AnimatSim
11 {
12  namespace Environment
13  {
25  class ANIMAT_PORT ContactSensor : public AnimatBase
26  {
27  protected:
29  CStdPtrArray<ReceptiveField> m_aryFields;
30 
33 
36 
39 
40  void LoadReceptiveField(CStdXml &oXml);
41 
42  bool FindReceptiveField(CStdPtrArray<ReceptiveField> &aryFields, float fltX, float fltY, float fltZ, int &iIndex);
43 
44  void DumpVertices(CStdPtrArray<ReceptiveField> &aryFields);
45 
46  virtual void AddReceptiveField(std::string strXml);
47  virtual void RemoveReceptiveField(std::string strID, bool bThrowError = true);
48  virtual int FindReceptiveFieldListPos(std::string strID, bool bThrowError = true);
49 
50  public:
51  ContactSensor();
52  virtual ~ContactSensor();
53 
54  static ContactSensor *CastToDerived(AnimatBase *lpBase) {return static_cast<ContactSensor*>(lpBase);}
55 
56  Gain *FieldGain();
57  Gain *CurrentGain();
58 
59  ReceptiveField *GetReceptiveField(int iIndex);
60  bool FindReceptiveField(float fltX, float fltY, float fltZ, int &iIndex);
61  int FindClosestReceptiveField(float fltX, float fltY, float fltZ);
62  void FinishedAddingVertices();
63 
64 #pragma region DataAccesMethods
65 
66  virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError = true, bool bDoNotInit = false);
67  virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError = true);
68 
69 #pragma endregion
70 
71  void ClearCurrents();
72  void ProcessContact(StdVector3 vPos, float fltForceMagnitude);
73  virtual void Load(CStdXml &oXml);
74  };
75 
76  } // Environment
77 } //AnimatSim
Root namespace for the base simulation library for AnimatLab.
float m_fltMaxForce
The maximum force force that we can use when calculating the current.
Definition: ContactSensor.h:38
Animat base class.
Definition: AnimatBase.h:36
Gain * m_lpFieldGain
The Gain function that modulates the force of contact based on the distance from the center of the Re...
Definition: ContactSensor.h:32
CStdPtrArray< ReceptiveField > m_aryFields
The array of ReceptiveField objects.
Definition: ContactSensor.h:29
Contact sensor for detecting receptive field contacts.
Definition: ContactSensor.h:25
Gain * m_lpCurrentGain
The Gain that calculates the amount of current to apply to any associated neurons based on the modula...
Definition: ContactSensor.h:35
Receptive field that generates current based on the amount of contact force, and how close it is to t...