dynamics3d_magnetism_plugin.h
Go to the documentation of this file.
1 
9 #ifndef DYNAMICS3D_MAGNETISM_PLUGIN_H
10 #define DYNAMICS3D_MAGNETISM_PLUGIN_H
11 
12 #include <argos3/plugins/simulator/physics_engines/dynamics3d/dynamics3d_plugin.h>
13 #include <argos3/plugins/simulator/physics_engines/dynamics3d/dynamics3d_model.h>
14 #include <argos3/plugins/simulator/entities/magnet_equipped_entity.h>
15 #include <argos3/core/utility/datatypes/datatypes.h>
16 #include <functional>
17 #include <limits>
18 #include <vector>
19 
20 namespace argos {
21 
22  /****************************************/
23  /****************************************/
24 
26  public:
28  m_fForceConstant(7.0500949e-13),
29  m_fMaxDistance(std::numeric_limits<Real>::infinity()) {}
30 
32 
33  virtual void Init(TConfigurationNode& t_tree);
34 
35  virtual void Reset() {}
36 
37  virtual void Destroy() {}
38 
39  virtual void RegisterModel(CDynamics3DModel& c_model);
40 
41  virtual void UnregisterModel(CDynamics3DModel& c_model);
42 
43  virtual void Update();
44 
45  private:
46 
47  btScalar m_fForceConstant;
48  btScalar m_fMaxDistance;
49 
50  struct SMagneticDipole {
51  /* Constructor */
52  SMagneticDipole(std::shared_ptr<CDynamics3DModel::CAbstractBody>& ptr_body,
53  const std::function<btVector3()>& fn_get_field,
54  const btTransform& c_offset) :
55  Body(ptr_body),
56  GetField(fn_get_field),
57  Offset(c_offset) {}
58  /* Members */
59  std::shared_ptr<CDynamics3DModel::CAbstractBody> Body;
60  std::function<btVector3()> GetField;
61  btTransform Offset;
62  };
63 
64  std::vector<SMagneticDipole> m_vecDipoles;
65  };
66 
67  /****************************************/
68  /****************************************/
69 
70 }
71 
72 #endif
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual void RegisterModel(CDynamics3DModel &c_model)
virtual void UnregisterModel(CDynamics3DModel &c_model)
virtual void Init(TConfigurationNode &t_tree)