Go to the documentation of this file.
17 #ifndef _GAZEBO_BATTERY_HH_
18 #define _GAZEBO_BATTERY_HH_
50 public std::enable_shared_from_this<Battery>
64 public:
virtual void Load(sdf::ElementPtr _sdf);
67 public:
virtual void Init();
72 public:
virtual void ResetVoltage();
76 public:
virtual void UpdateParameters(
const sdf::ElementPtr _sdf);
80 public: std::string Name()
const;
84 public: uint32_t AddConsumer();
90 public:
bool RemoveConsumer(
const uint32_t _consumerId);
96 public:
bool SetPowerLoad(
const uint32_t _consumerId,
97 const double _powerLoad);
103 public:
bool PowerLoad(
const uint32_t _consumerId,
104 double &_powerLoad)
const;
112 public:
double Voltage()
const;
121 public:
void SetUpdateFunc(
122 std::function<
double (
const BatteryPtr &)> _updateFunc);
127 public:
void Update();
130 protected:
void InitConsumers();
135 private:
double UpdateDefault(
const BatteryPtr &_battery);
139 private: BatteryPrivate *dataPtr;
std::string Name() const
Return the name of the battery.
virtual void ResetVoltage()
Reset the battery voltage to the initial value.
Forward declarations for the common classes.
Definition: Animation.hh:26
virtual void Load(sdf::ElementPtr _sdf)
Load the battery.
bool RemoveConsumer(const uint32_t _consumerId)
Remove a consumer.
virtual ~Battery()
Destructor.
void SetUpdateFunc(std::function< double(const BatteryPtr &)> _updateFunc)
Setup function to update voltage.
const PowerLoad_M & PowerLoads() const
Get list of power loads in watts.
virtual void Init()
Initialize.
bool SetPowerLoad(const uint32_t _consumerId, const double _powerLoad)
Set consumer power load in watts.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A battery abstraction.
Definition: Battery.hh:49
virtual void UpdateParameters(const sdf::ElementPtr _sdf)
Update the parameters using new sdf values.
std::shared_ptr< Battery > BatteryPtr
Definition: CommonTypes.hh:125
std::map< uint32_t, double > PowerLoad_M
Typedef the powerload map.
Definition: Battery.hh:54
uint32_t AddConsumer()
Create a unique consumer.
void InitConsumers()
Initialize the list of consumers.
double Voltage() const
Get the real voltage in volts.
bool PowerLoad(const uint32_t _consumerId, double &_powerLoad) const
Get consumer power load in watts.
void Update()
Update the battery.