DUNE: Uniform Navigational Environment
2.5.0-rc1
|
Public Member Functions | |
Task (const std::string &name, Tasks::Context &ctx) | |
void | onUpdateParameters (void) |
void | onResourceRelease (void) |
void | onResourceAcquisition (void) |
void | onEntityResolution (void) |
void | consume (const IMC::Voltage *msg) |
void | consume (const IMC::Current *msg) |
void | consume (const IMC::Temperature *msg) |
void | consume (const IMC::VehicleState *msg) |
float | getDeviationFromModel (const Models model) |
float | getDeviationMergedModel (const MergedModels model) |
float | getModelEstimate (const Models model) |
float | getModelEstimate (const Models model, float voltage) |
Models | getClosestModel (float temperature) |
float | getMapEstimate (const Models model, float current) |
float | getInvertedEstimate (const Models model, float energy) |
float | getMergedEstimate (const MergedModels model, float current, float temperature) |
float | getMergedEstimate (const MergedModels model) |
float | getRemainingTime (float power_rate) |
float | computeInitialEstimate (void) |
float | computeConfidence (float energy) |
float | computeConfidence (void) |
void | task (void) |
Public Member Functions inherited from DUNE::Tasks::Periodic | |
Periodic (const std::string &name, Context &ctx) | |
virtual | ~Periodic (void) |
void | setFrequency (double freq) |
double | getFrequency (void) const |
double | getRunTime (void) const |
unsigned | getRunCount (void) const |
Public Member Functions inherited from DUNE::Tasks::Task | |
Task (const std::string &name, Context &context) | |
virtual | ~Task (void) |
const char * | getName (void) const |
const char * | getSystemName (void) const |
unsigned int | getSystemId (void) const |
unsigned int | getEntityId (void) const |
uint16_t | getActivationTime (void) const |
uint16_t | getDeactivationTime (void) const |
unsigned int | resolveSystemName (const std::string &name) const |
const char * | resolveSystemId (unsigned int id) const |
void | loadConfig (void) |
void | setPriority (unsigned int value) |
unsigned int | getPriority (void) const |
void | inf (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void | war (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void void | err (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void void void | cri (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void void void void | debug (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void void void void void | trace (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void void void void void void | spew (const char *format,...) DUNE_PRINTF_FORMAT(2 |
void void void void void void void void | dispatch (IMC::Message *msg, unsigned int flags=0) |
void | dispatch (IMC::Message &msg, unsigned int flags=0) |
void | dispatchReply (const IMC::Message &original, IMC::Message &msg, unsigned int flags=0) |
void | receive (const IMC::Message *msg) |
void | reserveEntities (void) |
void | resolveEntities (void) |
void | acquireResources (void) |
void | releaseResources (void) |
void | initializeResources (void) |
void | updateParameters (bool act_deact=true) |
void | writeParamsXML (std::ostream &os) const |
Public Member Functions inherited from DUNE::Tasks::AbstractTask | |
AbstractTask (void) | |
virtual | ~AbstractTask (void) |
Public Member Functions inherited from DUNE::Concurrency::Thread | |
Thread (void) | |
virtual | ~Thread (void) |
int | getProcessorUsage (void) |
Public Member Functions inherited from DUNE::Concurrency::Runnable | |
Runnable (void) | |
virtual | ~Runnable (void) |
void | start (void) |
void | stop (void) |
void | join (void) |
void | stopAndJoin (void) |
void | setPriority (Scheduler::Policy policy, unsigned priority) |
State | getState (void) |
bool | isCreated (void) |
bool | isStopping (void) |
bool | isRunning (void) |
bool | isStarting (void) |
bool | isDead (void) |
Public Attributes | |
BatteryData * | m_bdata |
IMC::FuelLevel | m_fuel |
float | m_energy_consumed |
bool | m_has_initial_estimate |
float | m_initial_estimate |
double | m_last_time |
unsigned | m_total_samples |
bool | m_cold_estimate |
bool | m_redid_estimate |
unsigned | m_eids [BatteryData::BM_TOTAL] |
Time::Counter< float > | m_sane_timer |
bool | m_is_maneuvering |
Arguments | m_args |
Additional Inherited Members | |
Public Types inherited from DUNE::Concurrency::Runnable | |
enum | State { StateStarting, StateRunning, StateStopping, StateDead, StateUnknown } |
Protected Member Functions inherited from DUNE::Tasks::Task | |
const char * | getEntityLabel (void) const |
void | setEntityLabel (const std::string &label) |
void | setEntityState (IMC::EntityState::StateEnum state, Status::Code code) |
void | setEntityState (IMC::EntityState::StateEnum state, const std::string &description) |
IMC::EntityState::StateEnum | getEntityState (void) const |
unsigned int | reserveEntity (const std::string &label) |
unsigned int | resolveEntity (const std::string &label) const |
std::string | resolveEntity (unsigned int id) const |
bool | stopping (void) |
bool | isActive (void) const |
void | waitForMessages (double timeout) |
void | consumeMessages (void) |
template<typename T > | |
Parameter & | param (const std::string &name, T &var) |
template<typename Y , typename T > | |
Parameter & | param (const std::string &name, T &var) |
template<typename T > | |
bool | paramChanged (T &var) |
void | paramActive (Parameter::Scope def_scope, Parameter::Visibility def_visibility, bool def_value=false) |
void | setParamSectionEditor (const std::string &name) |
template<typename M , typename T > | |
void | bind (T *task_obj, void(T::*consumer)(const M *)=&T::consume) |
template<typename T > | |
void | bind (T *task_obj, const std::vector< uint32_t > &list) |
template<typename T > | |
void | bind (T *task_obj, const std::vector< std::string > &list) |
void | requestActivation (void) |
void | requestDeactivation (void) |
void | activate (void) |
void | activationFailed (const std::string &reason) |
void | deactivate (void) |
void | deactivationFailed (const std::string &reason) |
virtual void | onEntityReservation (void) |
virtual void | onReportEntityState (void) |
virtual void | onResourceInitialization (void) |
virtual void | onRequestActivation (void) |
virtual void | onRequestDeactivation (void) |
virtual void | onActivation (void) |
virtual void | onDeactivation (void) |
Protected Member Functions inherited from DUNE::Concurrency::Thread | |
void | startImpl (void) |
void | stopImpl (void) |
void | joinImpl (void) |
void | setPriorityImpl (Scheduler::Policy policy, unsigned priority) |
Protected Attributes inherited from DUNE::Tasks::Task | |
Context & | m_ctx |
|
inline |
References Monitors::FuelLevel::Arguments::acceptable_temperature, Monitors::FuelLevel::Arguments::avg_win, Monitors::FuelLevel::BatteryData::BM_TOTAL, Monitors::FuelLevel::BatteryModel::current, Monitors::FuelLevel::Arguments::decay_factor, DUNE::Tasks::Parameter::defaultValue(), DUNE::Tasks::Parameter::description(), Monitors::FuelLevel::Arguments::elb, Monitors::FuelLevel::BatteryModel::energy, Monitors::FuelLevel::Arguments::err_lvl, Monitors::FuelLevel::Arguments::full_capacity, Monitors::FuelLevel::Arguments::low_confidence, m_args, Monitors::FuelLevel::MDL_TOTAL, Monitors::FuelLevel::Arguments::min_samples, Monitors::FuelLevel::Arguments::models, Monitors::FuelLevel::Arguments::op_labels, Monitors::FuelLevel::Arguments::op_values, DUNE::Tasks::Task::param(), Monitors::FuelLevel::BatteryModel::temp, DUNE::Tasks::Parameter::units(), Monitors::FuelLevel::BatteryModel::voltage, and Monitors::FuelLevel::Arguments::war_lvl.
|
inline |
Compute a rough estimate of the confidence on the measure of energy (in %)
[in] | energy | to use |
References Monitors::FuelLevel::Arguments::full_capacity, getMergedEstimate(), getModelEstimate(), m_args, Monitors::FuelLevel::MDL_OPT, Monitors::FuelLevel::MDL_PES, Monitors::FuelLevel::MGD_RATED, and DUNE::Math::piecewiseLI().
|
inline |
Compute a rough estimate of the confidence on the measure of energy (in %)
References m_energy_consumed, and m_initial_estimate.
Referenced by task().
|
inline |
Compute an initial estimate for the energy left in batteries.
References Monitors::FuelLevel::BatteryModel::current, Monitors::FuelLevel::Arguments::decay_factor, Monitors::FuelLevel::Arguments::full_capacity, Monitors::FuelLevel::BatteryData::getCurrent(), getMergedEstimate(), getModelEstimate(), Monitors::FuelLevel::BatteryData::getTemperature(), m_args, m_bdata, m_cold_estimate, Monitors::FuelLevel::MDL_PES, Monitors::FuelLevel::MDL_VCOLD, Monitors::FuelLevel::MGD_ATAC, Monitors::FuelLevel::MGD_FTAC, Monitors::FuelLevel::MGD_RATED, Monitors::FuelLevel::Arguments::models, and Monitors::FuelLevel::BatteryModel::temp.
Referenced by task().
|
inline |
|
inline |
References m_bdata, and Monitors::FuelLevel::BatteryData::update().
|
inline |
References m_bdata, and Monitors::FuelLevel::BatteryData::update().
|
inline |
References m_is_maneuvering, and m_sane_timer.
|
inline |
Find closest model to a certain temperature.
[in] | temperature | temperature value to use |
References m_args, Monitors::FuelLevel::MDL_TOTAL, Monitors::FuelLevel::Arguments::models, and Monitors::FuelLevel::BatteryModel::temp.
Referenced by getMergedEstimate().
|
inline |
Compute deviation from model.
[in] | model | model to be used to compute deviation |
References getModelEstimate(), m_energy_consumed, and m_initial_estimate.
Referenced by task().
|
inline |
Compute deviation from a merged model.
[in] | model | merged model to be used to compute deviation |
References getMergedEstimate(), m_energy_consumed, and m_initial_estimate.
Referenced by task().
|
inline |
Compute voltage using energy value.
This works as an inverted getModelEstimate().
[in] | model | model to be used in compute the estimate |
[in] | energy | energy value to interpolate with to find voltage. |
References Monitors::FuelLevel::BatteryModel::energy, m_args, Monitors::FuelLevel::Arguments::models, DUNE::Math::piecewiseLI(), and Monitors::FuelLevel::BatteryModel::voltage.
Referenced by getMapEstimate().
|
inline |
Compute estimate for temperature map merged model.
[in] | model | temperature model to use |
[in] | current | electric current value to use in estimate |
References Monitors::FuelLevel::BatteryModel::current, getInvertedEstimate(), getModelEstimate(), Monitors::FuelLevel::BatteryData::getVoltage(), m_args, m_bdata, Monitors::FuelLevel::MDL_OPT, Monitors::FuelLevel::MDL_PES, and Monitors::FuelLevel::Arguments::models.
Referenced by getMergedEstimate().
|
inline |
Compute a merged estimate using an electric current value.
[in] | model | merged model to use |
[in] | current | electric current value to use |
[in] | temperature | temperature value to use |
References Monitors::FuelLevel::BatteryModel::current, getClosestModel(), getMapEstimate(), getModelEstimate(), DUNE::Math::linearInterpolation(), m_args, Monitors::FuelLevel::MDL_OPT, Monitors::FuelLevel::MDL_PES, Monitors::FuelLevel::MDL_VCOLD, Monitors::FuelLevel::MDL_ZERO, Monitors::FuelLevel::MGD_ATAC, Monitors::FuelLevel::MGD_FTAC, Monitors::FuelLevel::MGD_RATED, Monitors::FuelLevel::Arguments::models, and Monitors::FuelLevel::BatteryModel::temp.
Referenced by computeConfidence(), computeInitialEstimate(), getDeviationMergedModel(), and getMergedEstimate().
|
inline |
Compute a merged estimate using an electric current value (overload)
[in] | model | merged model to use |
References Monitors::FuelLevel::BatteryData::getCurrent(), getMergedEstimate(), Monitors::FuelLevel::BatteryData::getTemperature(), and m_bdata.
|
inline |
Compute an estimate based on a current discharge model.
[in] | model | model to be used in computing the estimate |
References Monitors::FuelLevel::BatteryData::getVoltage(), and m_bdata.
Referenced by computeConfidence(), computeInitialEstimate(), getDeviationFromModel(), getMapEstimate(), getMergedEstimate(), and task().
|
inline |
Compute an estimate based on a current discharge model.
[in] | model | model to be used in computing the estimate |
[in] | voltage | voltage to be used in optimistic and pessimistic model |
References Monitors::FuelLevel::BatteryModel::energy, m_args, Monitors::FuelLevel::Arguments::models, DUNE::Math::piecewiseLI(), and Monitors::FuelLevel::BatteryModel::voltage.
|
inline |
Estimate likely time left for operation in a certain power regime for available energy left in batteries.
[in] | power_rate | rate of power consumption |
References m_energy_consumed, and m_initial_estimate.
|
inlinevirtual |
Called when the task is instructed to resolve all the entity identifiers it needs for normal execution.
See resolveEntity(). Derived classes that need to resolve entity identifiers should override this function.
Reimplemented from DUNE::Tasks::Task.
References Monitors::FuelLevel::BatteryData::BM_TOTAL, Monitors::FuelLevel::Arguments::elb, m_args, m_eids, and DUNE::Tasks::Task::resolveEntity().
|
inlinevirtual |
Called when the task is instructed to acquire resources whose configuration is defined by run-time parameters.
Reimplemented from DUNE::Tasks::Task.
References Monitors::FuelLevel::Arguments::avg_win, m_args, m_bdata, m_eids, and Monitors::FuelLevel::BatteryData::setEntities().
|
inlinevirtual |
Called when the task is instructed to release resources.
Derived classes that override this function must not assume that any resource was previously acquired. This function must be implemented in such a way that it can be called at any time.
Reimplemented from DUNE::Tasks::Task.
References m_bdata.
|
inlinevirtual |
Called when the task is instructed to update its run-time parameters.
Derived classes that need to compute auxiliary values based on run-time parameters should override this function.
Reimplemented from DUNE::Tasks::Task.
References Monitors::FuelLevel::Arguments::decay_factor, Monitors::FuelLevel::BatteryModel::energy, DUNE::Tasks::Task::err(), m_args, Monitors::FuelLevel::MDL_TOTAL, Monitors::FuelLevel::Arguments::models, Monitors::FuelLevel::Arguments::op_labels, Monitors::FuelLevel::Arguments::op_values, DUNE::Tasks::Task::paramChanged(), and Monitors::FuelLevel::BatteryModel::voltage.
|
inlinevirtual |
The task to be executed on each cycle.
Implements DUNE::Tasks::Periodic.
References Monitors::FuelLevel::Arguments::acceptable_temperature, computeConfidence(), computeInitialEstimate(), DUNE::Tasks::Task::debug(), DUNE::Tasks::Task::dispatch(), Monitors::FuelLevel::Arguments::err_lvl, Monitors::FuelLevel::Arguments::full_capacity, Monitors::FuelLevel::BatteryData::getCurrent(), getDeviationFromModel(), getDeviationMergedModel(), DUNE::Tasks::Task::getEntityState(), getModelEstimate(), Monitors::FuelLevel::BatteryData::getTemperature(), Monitors::FuelLevel::BatteryData::gotMeasurements(), Monitors::FuelLevel::Arguments::low_confidence, m_args, m_bdata, m_cold_estimate, m_energy_consumed, m_fuel, m_has_initial_estimate, m_initial_estimate, m_is_maneuvering, m_redid_estimate, m_sane_timer, m_total_samples, Monitors::FuelLevel::MDL_OPT, Monitors::FuelLevel::MDL_PES, Monitors::FuelLevel::MGD_ATAC, Monitors::FuelLevel::MGD_FTAC, Monitors::FuelLevel::MGD_RATED, Monitors::FuelLevel::Arguments::min_samples, Monitors::FuelLevel::Arguments::op_labels, Monitors::FuelLevel::Arguments::op_values, DUNE::Tasks::Task::setEntityState(), DUNE::Tasks::Task::trace(), and Monitors::FuelLevel::Arguments::war_lvl.
Arguments Monitors::FuelLevel::Task::m_args |
BatteryData* Monitors::FuelLevel::Task::m_bdata |
Battery related data being measured.
Referenced by computeInitialEstimate(), consume(), getMapEstimate(), getMergedEstimate(), getModelEstimate(), onResourceAcquisition(), onResourceRelease(), and task().
bool Monitors::FuelLevel::Task::m_cold_estimate |
Present estimate was performed in cold temperatures.
Referenced by computeInitialEstimate(), and task().
unsigned Monitors::FuelLevel::Task::m_eids[BatteryData::BM_TOTAL] |
Array of entities.
Referenced by onEntityResolution(), and onResourceAcquisition().
float Monitors::FuelLevel::Task::m_energy_consumed |
Estimated amount of energy consumed in Wh since the task started.
Referenced by computeConfidence(), consume(), getDeviationFromModel(), getDeviationMergedModel(), getRemainingTime(), and task().
IMC::FuelLevel Monitors::FuelLevel::Task::m_fuel |
Fuel level message.
Referenced by task().
bool Monitors::FuelLevel::Task::m_has_initial_estimate |
Do we have an initial estimate.
Referenced by task().
float Monitors::FuelLevel::Task::m_initial_estimate |
Initial estimate of energy left in the batteries.
Referenced by computeConfidence(), getDeviationFromModel(), getDeviationMergedModel(), getRemainingTime(), and task().
bool Monitors::FuelLevel::Task::m_is_maneuvering |
double Monitors::FuelLevel::Task::m_last_time |
Last energy computation time.
Referenced by consume().
bool Monitors::FuelLevel::Task::m_redid_estimate |
Redo estimate only once.
Referenced by task().
Time::Counter<float> Monitors::FuelLevel::Task::m_sane_timer |
unsigned Monitors::FuelLevel::Task::m_total_samples |