7#include <argos3/core/simulator/simulator.h>
8#include <argos3/core/simulator/space/space.h>
9#include <argos3/core/simulator/entity/composable_entity.h>
19 m_fAvailableCharge(m_fFullCharge),
20 m_pcDischargeModel(nullptr) {
29 const std::string &str_id,
34 m_fFullCharge(f_full_charge),
35 m_fAvailableCharge(f_start_charge),
36 m_pcDischargeModel(nullptr) {
45 const std::string& str_id,
46 const std::string& str_discharge_model,
50 m_fFullCharge(f_full_charge),
51 m_fAvailableCharge(f_start_charge),
52 m_pcDischargeModel(nullptr) {
72 std::string strDischargeModel =
"time";
93 (*m_pcDischargeModel)();
112 if(str_model !=
"") {
122 m_pcBattery(nullptr) {
174 if(cComp !=
nullptr) {
236 if(cComp !=
nullptr) {
#define REGISTER_BATTERY_DISCHARGE_MODEL(CLASSNAME, LABEL)
float Real
Collects all ARGoS code.
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
#define REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(ENTITY)
The namespace containing all the ARGoS related code.
void GetNodeAttributeOrDefault(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer, const T &t_default)
Returns the value of a node's attribute, or the passed default value.
Real Distance(const CVector2 &c_v1, const CVector2 &c_v2)
Computes the distance between the passed vectors.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
T Max(const T &t_v1, const T &t_v2)
Returns the bigger of the two passed arguments.
Basic class for an entity that contains other entities.
This entity is a link to a body in the physics engine.
void Disable()
Disables the entity.
CEntity & GetRootEntity()
Returns the root entity containing this entity.
const std::string & GetId() const
Returns the id of this entity.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
CQuaternion Orientation
The orientation of the anchor wrt the global coordinate system.
CVector3 Position
The position of the anchor wrt the global coordinate system.
static CSimulator & GetInstance()
Returns the instance to the CSimulator class.
The exception that wraps all errors in ARGoS.
It defines the basic type CRadians, used to store an angle value in radians.
Real GetValue() const
Returns the value in radians.
CQuaternion Inverse() const
void ToAngleAxis(CRadians &c_angle, CVector3 &c_vector) const
static TYPE * New(const std::string &str_label)
Creates a new object of type TYPE
Real m_fAvailableCharge
Available charge.
void SetAvailableCharge(Real f_available_charge)
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Real m_fFullCharge
Full charge.
CBatteryEquippedEntity(CComposableEntity *pc_parent)
CBatteryDischargeModel * m_pcDischargeModel
Discharge model.
Real GetAvailableCharge() const
void SetDischargeModel(CBatteryDischargeModel *pc_model)
virtual ~CBatteryEquippedEntity()
virtual void Update()
Updates the state of this entity.
The discharge model dictates how the battery discharges over time.
CBatteryEquippedEntity * m_pcBattery
virtual void SetBattery(CBatteryEquippedEntity *pc_battery)
virtual ~CBatteryDischargeModel()
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
A battery discharge model based only on time.
virtual void operator()()
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.
const SAnchor * m_psAnchor
virtual void operator()()
CQuaternion m_cOldOrientation
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 operator()()
const SAnchor * m_psAnchor
virtual void SetBattery(CBatteryEquippedEntity *pc_battery)
CQuaternion m_cOldOrientation