Module integrating an interface for dealing with homeostatic needs Version:1.0.
More...
Module integrating an interface for dealing with homeostatic needs Version:1.0.
- Author
- Jordi-Ysard Puigbò jordi.nosp@m.ysar.nosp@m.d.pui.nosp@m.gbo@.nosp@m.upf.e.nosp@m.du, Clément Moulin-Frier cleme.nosp@m.nt.m.nosp@m.oulin.nosp@m.-fri.nosp@m.er@up.nosp@m.f.ed.nosp@m.u
- Copyright
- Released under the terms of the GNU GPL v2.0
Description
Module that internally handles the dynamics of the defined needs. Needs are internal variables linked to external measurements (or sensations) and associated drives (e.g. the drive to ask satisfies the need of acquiring new knowledge). Needs are tipically defined by some dynamics (i.e. a decay or a direct dependence to a variable), their internal value (i.e. current state of the need) and an upper and lower boundaries, limiting a zone of confort where an action is not required. This module is strongly dependent on the allostaticController and sensationsManager. An example of how to create a drive can be found in app/reactiveLayer/homeostasis/conf/example.ini
Parameters
- – name : name of the module
- – verbose : change degree of verbosity of the module
- – period : change the update rate of this module
Input Ports
- /homeostasis/rpc [Bottle] [default carrier:tcp]: Response port. Supported commands:
- help
- ['par'] ['drive'] ['val'/'min'/'max'/'dec'] [value] : Assigns a value to a specific parameter
- ['delta'] ['drive'] ['val'/'min'/'max'/'dec'] [value] : Adds a value to a specific parameter
- ['ask'] ['drive'] ['val'/'min'/'max'/'dec'] [value] : Returns a value to a specific parameter
- ['add'] ['conf'] [drive Bottle] : Adds a drive to the manager as a drive directly read from conf-file
- ['add'] ['botl'] [drive Bottle] : Adds a drive to the manager as a Bottle of values of shape
- ['add'] ['new'] [drive name] : Adds a default drive to the manager
- ['rm'] [drive name] : removes a drive from the manager
- ['sleep'] [drive name] [time] : prevent drive update for a certain time (in seconds)
- [freeze'/'unfreeze'] [drive name] : prevent / allow drive to update
- ['sleep'] ['all'] [time] : prevent all drive updates for a certain time (in seconds)
- [freeze'/'unfreeze'] ['all'] [time] : prevent / allow all drive updates
- ['names'] : returns an ordered list of the drives in the manager
- ['verbose'] [true/false] : change verbosity
- /homeostasis/fromSensations:i [Bottle] [default carrier:tcp]: Communication port to sensations to adapt needs accordingly.
Output Ports
- /homeostasis/drive_name/min:o [Bottle] [default carrier:tcp]: Communication port to allostaticController.
- /homeostasis/drive_name/max:o [Bottle] [default carrier:tcp]: Communication port to allostaticController.
Services
◆ Drive
Definition at line 14 of file homeostasis.h.
Public Member Functions |
| Drive (std::string d_name, double d_period, std::string d_key="default", double d_value=0.5, double d_homeo_min=0.25, double d_homeo_max=0.75, double d_decay=0.05, double d_value_min=std::numeric_limits< double >::min(), double d_value_max=std::numeric_limits< double >::max(), bool d_gradient=false) |
|
| Drive ()=delete |
| No default constructor! More...
|
|
void | setKey (std::string d_key) |
|
void | setValue (double d_value) |
|
void | deltaValue (double d_value) |
|
void | setHomeostasisMin (double d_homeo_min) |
|
void | deltaHomeostasisMin (double d_homeo_min) |
|
void | setHomeostasisMax (double d_homeo_max) |
|
void | deltaHomeostasisMax (double d_homeo_max) |
|
void | setDecay (double d_decay) |
|
void | deltaDecay (double d_decay) |
|
void | setDecayMultiplier (double mult) |
|
void | sleep (double t) |
| sleep Sleep drive for t seconds, i.e. More...
|
|
void | freeze () |
| freeze Freeze (sleep) drive indefinitely More...
|
|
void | reset () |
| reset Set value back to default_value More...
|
|
void | unfreeze () |
| unfreeze Unfreeze drive More...
|
|
void | update () |
| update Let drive decay More...
|
|
double | getValue () |
|
void | setName (std::string n) |
|
void | setGradient (bool b) |
|
Public Attributes |
std::string | name |
| Name of the drive. More...
|
|
std::string | key |
| Deprecated, not used anymore. More...
|
|
double | period |
|
double | value |
|
double | homeostasisMin |
|
double | homeostasisMax |
|
double | decay |
|
double | valueMin |
|
double | valueMax |
|
double | default_value |
|
double | decay_multiplier |
|
bool | gradient |
|
time_t | start_sleep |
| Time when the drive started to be sleeping. More...
|
|
bool | is_sleeping |
| Whether drive is sleeping. More...
|
|
double | time_to_sleep |
| Timespan to be sleeping. More...
|
|
◆ Drive() [1/2]
Drive::Drive |
( |
std::string |
d_name, |
|
|
double |
d_period, |
|
|
std::string |
d_key = "default" , |
|
|
double |
d_value = 0.5 , |
|
|
double |
d_homeo_min = 0.25 , |
|
|
double |
d_homeo_max = 0.75 , |
|
|
double |
d_decay = 0.05 , |
|
|
double |
d_value_min = std::numeric_limits<double>::min() , |
|
|
double |
d_value_max = std::numeric_limits<double>::max() , |
|
|
bool |
d_gradient = false |
|
) |
| |
|
inline |
◆ Drive() [2/2]
◆ deltaDecay()
void Drive::deltaDecay |
( |
double |
d_decay | ) |
|
|
inline |
◆ deltaHomeostasisMax()
void Drive::deltaHomeostasisMax |
( |
double |
d_homeo_max | ) |
|
|
inline |
◆ deltaHomeostasisMin()
void Drive::deltaHomeostasisMin |
( |
double |
d_homeo_min | ) |
|
|
inline |
◆ deltaValue()
void Drive::deltaValue |
( |
double |
d_value | ) |
|
|
inline |
◆ freeze()
freeze Freeze (sleep) drive indefinitely
Definition at line 111 of file homeostasis.h.
◆ getValue()
double Drive::getValue |
( |
| ) |
|
|
inline |
◆ reset()
reset Set value back to default_value
Definition at line 120 of file homeostasis.h.
◆ setDecay()
void Drive::setDecay |
( |
double |
d_decay | ) |
|
|
inline |
◆ setDecayMultiplier()
void Drive::setDecayMultiplier |
( |
double |
mult | ) |
|
|
inline |
◆ setGradient()
void Drive::setGradient |
( |
bool |
b | ) |
|
|
inline |
◆ setHomeostasisMax()
void Drive::setHomeostasisMax |
( |
double |
d_homeo_max | ) |
|
|
inline |
◆ setHomeostasisMin()
void Drive::setHomeostasisMin |
( |
double |
d_homeo_min | ) |
|
|
inline |
◆ setKey()
void Drive::setKey |
( |
std::string |
d_key | ) |
|
|
inline |
◆ setName()
void Drive::setName |
( |
std::string |
n | ) |
|
|
inline |
◆ setValue()
void Drive::setValue |
( |
double |
d_value | ) |
|
|
inline |
◆ sleep()
void Drive::sleep |
( |
double |
t | ) |
|
|
inline |
sleep Sleep drive for t seconds, i.e.
drive won't decay
- Parameters
-
Definition at line 102 of file homeostasis.h.
◆ unfreeze()
◆ update()
◆ decay
◆ decay_multiplier
double Drive::decay_multiplier |
◆ default_value
double Drive::default_value |
◆ gradient
◆ homeostasisMax
double Drive::homeostasisMax |
◆ homeostasisMin
double Drive::homeostasisMin |
◆ is_sleeping
◆ key
◆ name
◆ period
◆ start_sleep
time_t Drive::start_sleep |
Time when the drive started to be sleeping.
Definition at line 22 of file homeostasis.h.
◆ time_to_sleep
double Drive::time_to_sleep |
◆ value
◆ valueMax
◆ valueMin
◆ HomeostasisManager
Definition at line 13 of file homeostasisManager.h.
◆ addDrive()
void HomeostasisManager::addDrive |
( |
Drive * |
D | ) |
|
addDrive Generates a drive in the homeostasis manager.
Homeostasis manager will take care of updating it. Input must be a drive and its position
- Parameters
-
Definition at line 13 of file homeostasisManager.cpp.
◆ removeDrive()
void HomeostasisManager::removeDrive |
( |
int |
D | ) |
|
removeDrive Removes a drive in homeostasis manager.
Anything related to this drive outside here should also be removed. This is specially useful for temporal needs or subgoals.
- Parameters
-
Definition at line 18 of file homeostasisManager.cpp.
◆ sleep()
void HomeostasisManager::sleep |
( |
int |
D, |
|
|
double |
time |
|
) |
| |
sleep cancels update function for a time
- Parameters
-
D | ID drive to add |
time | time to sleep |
Definition at line 23 of file homeostasisManager.cpp.
◆ updateDrives()
bool HomeostasisManager::updateDrives |
( |
| ) |
|
◆ drives
std::vector<Drive*> HomeostasisManager::drives |
◆ HomeostaticModule
Definition at line 18 of file homeostasisManagerIcub.h.
◆ bDrive()
Drive HomeostaticModule::bDrive |
( |
yarp::os::Bottle * |
b | ) |
|
|
inline |
◆ close()
bool HomeostaticModule::close |
( |
| ) |
|
◆ configure()
bool HomeostaticModule::configure |
( |
yarp::os::ResourceFinder & |
rf | ) |
|
◆ getPeriod()
double HomeostaticModule::getPeriod |
( |
| ) |
|
|
inline |
◆ interruptModule()
bool HomeostaticModule::interruptModule |
( |
| ) |
|
|
inline |
◆ openPorts()
int HomeostaticModule::openPorts |
( |
std::string |
driveName | ) |
|
openPorts opens default ports for external communication
- Parameters
-
driveName | name of the drive |
- Returns
- int success
Definition at line 49 of file homeostasisManagerIcub.cpp.
◆ respond()
bool HomeostaticModule::respond |
( |
const yarp::os::Bottle & |
cmd, |
|
|
yarp::os::Bottle & |
reply |
|
) |
| |
◆ updateModule()
bool HomeostaticModule::updateModule |
( |
| ) |
|