ARGoS 3
A parallel, multi-engine simulator for swarm robotics
battery_equipped_entity.h
Go to the documentation of this file.
1
7#ifndef BATTERY_EQUIPPED_ENTITY_H
8#define BATTERY_EQUIPPED_ENTITY_H
9
10namespace argos {
11 class CBatteryEquippedEntity;
12 class CBatteryDischargeModel;
13}
14
15#include <argos3/core/utility/math/vector3.h>
16#include <argos3/core/simulator/entity/entity.h>
17#include <argos3/core/simulator/entity/embodied_entity.h>
18#include <map>
19
20namespace argos {
21
22 /****************************************/
23 /****************************************/
24
34
35 public:
36
38
39 public:
40
42
44 const std::string& str_id,
45 CBatteryDischargeModel* pc_discharge_model = NULL,
46 Real f_start_charge = 1.0,
47 Real f_full_charge = 1.0);
48
50 const std::string& str_id,
51 const std::string& str_discharge_model,
52 Real f_start_charge = 1.0,
53 Real f_full_charge = 1.0);
54
56
57 virtual void Init(TConfigurationNode& t_tree);
58
59 virtual std::string GetTypeDescription() const {
60 return "battery";
61 }
62
63 virtual void Update();
64
66 return m_fFullCharge;
67 }
68
69 void SetFullCharge(Real f_full_charge) {
70 m_fFullCharge = f_full_charge;
71 }
72
74 return m_fAvailableCharge;
75 }
76
77 void SetAvailableCharge(Real f_available_charge) {
78 m_fAvailableCharge = f_available_charge;
79 }
80
82
83 void SetDischargeModel(const std::string& str_model);
84
85 protected:
86
93 };
94
95 /****************************************/
96 /****************************************/
97
103
104 public:
105
107
108 virtual ~CBatteryDischargeModel();
109
110 virtual void Init(TConfigurationNode& t_tree) {}
111
112 virtual void Reset() {}
113
114 virtual void Destroy() {}
115
116 virtual void SetBattery(CBatteryEquippedEntity* pc_battery);
117
118 virtual void operator()() = 0;
119
120 protected:
121
123 };
124
125 /****************************************/
126 /****************************************/
127
132
133#define REGISTER_BATTERY_DISCHARGE_MODEL(CLASSNAME, LABEL) \
134 REGISTER_SYMBOL(CBatteryDischargeModel, \
135 CLASSNAME, \
136 LABEL, \
137 "undefined", \
138 "undefined", \
139 "undefined", \
140 "undefined", \
141 "undefined")
142
143 /****************************************/
144 /****************************************/
145
154
155 public:
156
159
160 virtual void Init(TConfigurationNode& t_tree);
161
162 void SetDelta(Real f_delta) {
163 m_fDelta = f_delta;
164 }
165
166 virtual void operator()();
167
168 protected:
169
173 };
174
175 /****************************************/
176 /****************************************/
177
186
187 public:
188
193
194 virtual void Init(TConfigurationNode& t_tree);
195
196 void SetPosFactor(Real f_factor) {
197 m_fPosFactor = f_factor;
198 }
199
200 void SetOrientFactor(Real f_factor) {
201 m_fOrientFactor = f_factor;
202 }
203
204 virtual void SetBattery(CBatteryEquippedEntity* pc_battery);
205
206 virtual void operator()();
207
208 protected:
209
215 };
216
217 /****************************************/
218 /****************************************/
219
228
229 public:
230
232 m_psAnchor(NULL),
233 m_fDelta(1e-5),
234 m_fPosFactor(1e-3),
235 m_fOrientFactor(1e-3) {}
236
237 virtual void Init(TConfigurationNode& t_tree);
238
239 void SetDelta(Real f_delta) {
240 m_fDelta = f_delta;
241 }
242
243 void SetPosFactor(Real f_factor) {
244 m_fPosFactor = f_factor;
245 }
246
247 void SetOrientFactor(Real f_factor) {
248 m_fOrientFactor = f_factor;
249 }
250
251 virtual void SetBattery(CBatteryEquippedEntity* pc_battery);
252
253 virtual void operator()();
254
255 protected:
256
263 };
264
265 /****************************************/
266 /****************************************/
267
268}
269
270#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.
CFactory< CBatteryDischargeModel > TFactoryBatteryDischargeModel
For dynamic loading of battery discharge models.
Basic class for an entity that contains other entities.
The basic entity type.
Definition entity.h:90
An anchor related to the body of an entity.
This class is the base of all XML-configurable ARGoS interface.
A 3D vector class.
Definition vector3.h:31
Basic factory template.
Definition factory.h:59
void SetAvailableCharge(Real f_available_charge)
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
CBatteryEquippedEntity(CComposableEntity *pc_parent)
CBatteryDischargeModel * m_pcDischargeModel
Discharge model.
void SetDischargeModel(CBatteryDischargeModel *pc_model)
void SetFullCharge(Real f_full_charge)
virtual void Update()
Updates the state of this entity.
virtual std::string GetTypeDescription() const
Returns a string label for this class.
The discharge model dictates how the battery discharges over time.
virtual void Reset()
Resets the resource.
virtual void SetBattery(CBatteryEquippedEntity *pc_battery)
virtual void Destroy()
Undoes whatever was done by Init().
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
A battery discharge model based only on time.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
A battery discharge model based only on motion.
virtual void SetBattery(CBatteryEquippedEntity *pc_battery)
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
A battery discharge model in which the charge decreases with both time and motion.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
virtual void SetBattery(CBatteryEquippedEntity *pc_battery)