7#include <argos3/core/simulator/simulator.h>
8#include <argos3/core/simulator/space/space.h>
9#include <argos3/core/simulator/entity/composable_entity.h>
29 const std::string &str_id,
45 const std::string& str_id,
46 const std::string& str_discharge_model,
72 std::string strDischargeModel =
"time";
93 (*m_pcDischargeModel)();
112 if(str_model !=
"") {
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.
CEntity(CComposableEntity *pc_parent)
Class constructor.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
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.
void ToAngleAxis(CRadians &c_angle, CVector3 &c_vector) const
static CBatteryDischargeModel * New(const std::string &str_label)
Real m_fAvailableCharge
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.
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()
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