magnet_entity.h
Go to the documentation of this file.
1 
7 #ifndef MAGNET_ENTITY_H
8 #define MAGNET_ENTITY_H
9 
10 namespace argos {
11  class CMagnetEntity;
12 }
13 
14 #include <argos3/core/simulator/entity/entity.h>
15 #include <argos3/core/utility/math/vector3.h>
16 
17 namespace argos {
18 
19  class CMagnetEntity : public CEntity {
20 
21  public:
22 
23  ENABLE_VTABLE();
24 
25  public:
26 
27  CMagnetEntity(CComposableEntity* pc_parent);
28 
30  const std::string& str_id,
31  const CVector3& c_passive_field,
32  const CVector3& c_active_field);
33 
34  virtual ~CMagnetEntity() {}
35 
36  virtual void Init(TConfigurationNode& t_tree);
37 
38  virtual void Reset();
39 
45  inline const CVector3& GetField() const {
46  return m_cField;
47  }
48 
55  inline const CVector3& GetPassiveField() const {
56  return m_cPassiveField;
57  }
58 
66  inline const CVector3& GetActiveField() const {
67  return m_cActiveField;
68  }
69 
75  inline void SetCurrent(Real f_current) {
76  m_cField = m_cPassiveField + m_cActiveField * f_current;
77  }
78 
79  virtual std::string GetTypeDescription() const {
80  return "magnet";
81  }
82 
83  protected:
84 
88 
89  };
90 
91  /****************************************/
92  /****************************************/
93 
94 }
95 
96 #endif
A 3D vector class.
Definition: vector3.h:29
void SetCurrent(Real f_current)
Sets the current field of the magnet.
Definition: magnet_entity.h:75
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
The basic entity type.
Definition: entity.h:89
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual ~CMagnetEntity()
Definition: magnet_entity.h:34
virtual std::string GetTypeDescription() const
Returns a string label for this class.
Definition: magnet_entity.h:79
Basic class for an entity that contains other entities.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
CMagnetEntity(CComposableEntity *pc_parent)
const CVector3 & GetField() const
Returns the field of the magnet.
Definition: magnet_entity.h:45
const CVector3 & GetActiveField() const
Returns the active field with which the magnet was initialized.
Definition: magnet_entity.h:66
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
const CVector3 & GetPassiveField() const
Returns the passive field with which the magnet was initialized.
Definition: magnet_entity.h:55