icub-client
Classes
behaviorManager

Module for quick control of default complex behaviors. More...

+ Collaboration diagram for behaviorManager:

Classes

class  Behavior
 
class  BehaviorManager
 
class  Dummy
 
class  MoveObject
 
class  Pointing
 
class  RecognitionOrder
 
class  Tagging
 

Detailed Description

Module for quick control of default complex behaviors.

Version:1.0

Author
Clément Moulin-Frier cleme.nosp@m.nt.m.nosp@m.oulin.nosp@m.frie.nosp@m.r@gma.nosp@m.il.c.nosp@m.om, Jordi-Ysard Puigbò jordi.nosp@m.ysar.nosp@m.d.pui.nosp@m.gbo@.nosp@m.upf.e.nosp@m.du

Description

This module contains an interface to easily schedule behaviors. The interface allows the creation of default complex behaviors (e.g. asking for the name of an object while pointing to it and looking to a human partner). It allows to easily define this behaviors through calls to the icub-client library or other modules. This behaviours can receive arguments with additional metadata (e.g. internal ID of the object to ask for) or obtain this information from sensationManager. The behaviours are scheduled in order to avoid conflicts, only allowing one behaviour to run at the same time. Moreover, all drives can be called by an RPC command with the name and the corresponding arguments. Additionally, through a config file, the user can select which drives will be available at every execution. In the context of the reactiveLayer, behaviorManager exists to execute behaviors triggered by the drives in the allostaticController.

Parameters

Input Ports

Output Ports

Services


Class Documentation

◆ Behavior

class Behavior

Definition at line 13 of file behavior.h.

+ Inheritance diagram for Behavior:

Public Member Functions

 Behavior (yarp::os::Mutex *_mut, yarp::os::ResourceFinder &_rf, icubclient::ICubClient *_iCub, std::string _behaviorName)
 
 Behavior ()=delete
 No default constructor! More...
 
virtual ~Behavior ()
 
void openPorts (std::string port_name_prefix)
 openPorts open ports defined for a behavior More...
 
bool trigger (const yarp::os::Bottle &args)
 trigger triggers this behavior and blocks the mutex More...
 
virtual void configure ()=0
 
void interrupt_ports ()
 interrupt_ports interrupt ports defined for a behavior More...
 
void close_ports ()
 close_ports close ports defined for a behavior More...
 

Public Attributes

yarp::os::Port rpc_out_port
 Port to external module. More...
 
std::string behaviorName
 
std::string from_sensation_port_name
 
std::string external_port_name
 
yarp::os::BufferedPort< yarp::os::Bottle > sensation_port_in
 Input port from sensationManager. More...
 

Protected Member Functions

virtual void run (const yarp::os::Bottle &args)=0
 
virtual void close_extra_ports ()=0
 

Protected Attributes

icubclient::ICubClientiCub
 
yarp::os::ResourceFinder & rf
 

Constructor & Destructor Documentation

◆ Behavior() [1/2]

Behavior::Behavior ( yarp::os::Mutex *  _mut,
yarp::os::ResourceFinder &  _rf,
icubclient::ICubClient _iCub,
std::string  _behaviorName 
)
inline

Definition at line 30 of file behavior.h.

◆ Behavior() [2/2]

Behavior::Behavior ( )
delete

No default constructor!

◆ ~Behavior()

virtual Behavior::~Behavior ( )
inlinevirtual

Definition at line 36 of file behavior.h.

Member Function Documentation

◆ close_extra_ports()

virtual void Behavior::close_extra_ports ( )
protectedpure virtual

◆ close_ports()

void Behavior::close_ports ( )
inline

close_ports close ports defined for a behavior

Definition at line 97 of file behavior.h.

◆ configure()

virtual void Behavior::configure ( )
pure virtual

◆ interrupt_ports()

void Behavior::interrupt_ports ( )
inline

interrupt_ports interrupt ports defined for a behavior

Definition at line 88 of file behavior.h.

◆ openPorts()

void Behavior::openPorts ( std::string  port_name_prefix)
inline

openPorts open ports defined for a behavior

Parameters
port_name_prefixunique prefix name for the port
Returns
void

Definition at line 43 of file behavior.h.

◆ run()

virtual void Behavior::run ( const yarp::os::Bottle &  args)
protectedpure virtual

◆ trigger()

bool Behavior::trigger ( const yarp::os::Bottle &  args)
inline

trigger triggers this behavior and blocks the mutex

Parameters
argsbottle with arguments for this behaviours if not provided, taken from sensations or return error
Returns
bool false if not triggered because of mutex blocked

Definition at line 58 of file behavior.h.

Member Data Documentation

◆ behaviorName

std::string Behavior::behaviorName

Definition at line 27 of file behavior.h.

◆ external_port_name

std::string Behavior::external_port_name

Definition at line 27 of file behavior.h.

◆ from_sensation_port_name

std::string Behavior::from_sensation_port_name

Definition at line 27 of file behavior.h.

◆ iCub

icubclient::ICubClient* Behavior::iCub
protected

Definition at line 20 of file behavior.h.

◆ rf

yarp::os::ResourceFinder& Behavior::rf
protected

Definition at line 21 of file behavior.h.

◆ rpc_out_port

yarp::os::Port Behavior::rpc_out_port

Port to external module.

Definition at line 26 of file behavior.h.

◆ sensation_port_in

yarp::os::BufferedPort<yarp::os::Bottle> Behavior::sensation_port_in

Input port from sensationManager.

Definition at line 28 of file behavior.h.

◆ BehaviorManager

class BehaviorManager

Definition at line 12 of file behaviorManager.h.

+ Inheritance diagram for BehaviorManager:

Public Member Functions

 BehaviorManager ()
 
bool configure (yarp::os::ResourceFinder &rf)
 
bool interruptModule ()
 
bool close ()
 
double getPeriod ()
 
bool updateModule ()
 
bool respond (const yarp::os::Bottle &cmd, yarp::os::Bottle &reply)
 

Constructor & Destructor Documentation

◆ BehaviorManager()

BehaviorManager::BehaviorManager ( )
inline

Definition at line 28 of file behaviorManager.h.

Member Function Documentation

◆ close()

bool BehaviorManager::close ( )

Definition at line 22 of file behaviorManager.cpp.

◆ configure()

bool BehaviorManager::configure ( yarp::os::ResourceFinder &  rf)

Definition at line 40 of file behaviorManager.cpp.

◆ getPeriod()

double BehaviorManager::getPeriod ( )
inline

Definition at line 38 of file behaviorManager.h.

◆ interruptModule()

bool BehaviorManager::interruptModule ( )

Definition at line 12 of file behaviorManager.cpp.

◆ respond()

bool BehaviorManager::respond ( const yarp::os::Bottle &  cmd,
yarp::os::Bottle &  reply 
)

Definition at line 122 of file behaviorManager.cpp.

◆ updateModule()

bool BehaviorManager::updateModule ( )

Definition at line 116 of file behaviorManager.cpp.

◆ Dummy

class Dummy

Definition at line 12 of file dummy.h.

+ Inheritance diagram for Dummy:

Public Member Functions

 Dummy (yarp::os::Mutex *mut, yarp::os::ResourceFinder &rf, icubclient::ICubClient *iCub, std::string behaviorName)
 
void configure ()
 
- Public Member Functions inherited from Behavior
 Behavior (yarp::os::Mutex *_mut, yarp::os::ResourceFinder &_rf, icubclient::ICubClient *_iCub, std::string _behaviorName)
 
 Behavior ()=delete
 No default constructor! More...
 
virtual ~Behavior ()
 
void openPorts (std::string port_name_prefix)
 openPorts open ports defined for a behavior More...
 
bool trigger (const yarp::os::Bottle &args)
 trigger triggers this behavior and blocks the mutex More...
 
void interrupt_ports ()
 interrupt_ports interrupt ports defined for a behavior More...
 
void close_ports ()
 close_ports close ports defined for a behavior More...
 

Protected Member Functions

void run (const yarp::os::Bottle &)
 
void close_extra_ports ()
 

Additional Inherited Members

- Public Attributes inherited from Behavior
yarp::os::Port rpc_out_port
 Port to external module. More...
 
std::string behaviorName
 
std::string from_sensation_port_name
 
std::string external_port_name
 
yarp::os::BufferedPort< yarp::os::Bottle > sensation_port_in
 Input port from sensationManager. More...
 
- Protected Attributes inherited from Behavior
icubclient::ICubClientiCub
 
yarp::os::ResourceFinder & rf
 

Constructor & Destructor Documentation

◆ Dummy()

Dummy::Dummy ( yarp::os::Mutex *  mut,
yarp::os::ResourceFinder &  rf,
icubclient::ICubClient iCub,
std::string  behaviorName 
)
inline

Definition at line 30 of file dummy.h.

Member Function Documentation

◆ close_extra_ports()

void Dummy::close_extra_ports ( )
inlineprotectedvirtual

Implements Behavior.

Definition at line 25 of file dummy.h.

◆ configure()

void Dummy::configure ( )
inlinevirtual

Implements Behavior.

Definition at line 35 of file dummy.h.

◆ run()

void Dummy::run ( const yarp::os::Bottle &  )
inlineprotectedvirtual

Implements Behavior.

Definition at line 19 of file dummy.h.

◆ MoveObject

class MoveObject

Definition at line 9 of file moveObject.h.

+ Inheritance diagram for MoveObject:

Public Member Functions

 MoveObject (yarp::os::Mutex *mut, yarp::os::ResourceFinder &rf, icubclient::ICubClient *iCub, std::string behaviorName)
 
void configure ()
 
- Public Member Functions inherited from Behavior
 Behavior (yarp::os::Mutex *_mut, yarp::os::ResourceFinder &_rf, icubclient::ICubClient *_iCub, std::string _behaviorName)
 
 Behavior ()=delete
 No default constructor! More...
 
virtual ~Behavior ()
 
void openPorts (std::string port_name_prefix)
 openPorts open ports defined for a behavior More...
 
bool trigger (const yarp::os::Bottle &args)
 trigger triggers this behavior and blocks the mutex More...
 
void interrupt_ports ()
 interrupt_ports interrupt ports defined for a behavior More...
 
void close_ports ()
 close_ports close ports defined for a behavior More...
 

Protected Member Functions

void run (const yarp::os::Bottle &args)
 
void close_extra_ports ()
 

Protected Attributes

double target_pullback
 
double target_pushfront
 
double target_pushleft
 
double target_pushright
 
- Protected Attributes inherited from Behavior
icubclient::ICubClientiCub
 
yarp::os::ResourceFinder & rf
 

Additional Inherited Members

- Public Attributes inherited from Behavior
yarp::os::Port rpc_out_port
 Port to external module. More...
 
std::string behaviorName
 
std::string from_sensation_port_name
 
std::string external_port_name
 
yarp::os::BufferedPort< yarp::os::Bottle > sensation_port_in
 Input port from sensationManager. More...
 

Constructor & Destructor Documentation

◆ MoveObject()

MoveObject::MoveObject ( yarp::os::Mutex *  mut,
yarp::os::ResourceFinder &  rf,
icubclient::ICubClient iCub,
std::string  behaviorName 
)
inline

Definition at line 24 of file moveObject.h.

Member Function Documentation

◆ close_extra_ports()

void MoveObject::close_extra_ports ( )
inlineprotectedvirtual

Implements Behavior.

Definition at line 19 of file moveObject.h.

◆ configure()

void MoveObject::configure ( )
virtual

Implements Behavior.

Definition at line 6 of file moveObject.cpp.

◆ run()

void MoveObject::run ( const yarp::os::Bottle &  args)
protectedvirtual

Implements Behavior.

Definition at line 14 of file moveObject.cpp.

Member Data Documentation

◆ target_pullback

double MoveObject::target_pullback
protected

Definition at line 14 of file moveObject.h.

◆ target_pushfront

double MoveObject::target_pushfront
protected

Definition at line 15 of file moveObject.h.

◆ target_pushleft

double MoveObject::target_pushleft
protected

Definition at line 16 of file moveObject.h.

◆ target_pushright

double MoveObject::target_pushright
protected

Definition at line 17 of file moveObject.h.

◆ Pointing

class Pointing

Definition at line 12 of file pointing.h.

+ Inheritance diagram for Pointing:

Public Member Functions

 Pointing (yarp::os::Mutex *mut, yarp::os::ResourceFinder &rf, icubclient::ICubClient *iCub, std::string behaviorName)
 
void configure ()
 
- Public Member Functions inherited from Behavior
 Behavior (yarp::os::Mutex *_mut, yarp::os::ResourceFinder &_rf, icubclient::ICubClient *_iCub, std::string _behaviorName)
 
 Behavior ()=delete
 No default constructor! More...
 
virtual ~Behavior ()
 
void openPorts (std::string port_name_prefix)
 openPorts open ports defined for a behavior More...
 
bool trigger (const yarp::os::Bottle &args)
 trigger triggers this behavior and blocks the mutex More...
 
void interrupt_ports ()
 interrupt_ports interrupt ports defined for a behavior More...
 
void close_ports ()
 close_ports close ports defined for a behavior More...
 

Protected Member Functions

void run (const yarp::os::Bottle &args)
 
void close_extra_ports ()
 

Additional Inherited Members

- Public Attributes inherited from Behavior
yarp::os::Port rpc_out_port
 Port to external module. More...
 
std::string behaviorName
 
std::string from_sensation_port_name
 
std::string external_port_name
 
yarp::os::BufferedPort< yarp::os::Bottle > sensation_port_in
 Input port from sensationManager. More...
 
- Protected Attributes inherited from Behavior
icubclient::ICubClientiCub
 
yarp::os::ResourceFinder & rf
 

Constructor & Destructor Documentation

◆ Pointing()

Pointing::Pointing ( yarp::os::Mutex *  mut,
yarp::os::ResourceFinder &  rf,
icubclient::ICubClient iCub,
std::string  behaviorName 
)
inline

Definition at line 22 of file pointing.h.

Member Function Documentation

◆ close_extra_ports()

void Pointing::close_extra_ports ( )
inlineprotectedvirtual

Implements Behavior.

Definition at line 17 of file pointing.h.

◆ configure()

void Pointing::configure ( )
virtual

Implements Behavior.

Definition at line 7 of file pointing.cpp.

◆ run()

void Pointing::run ( const yarp::os::Bottle &  args)
protectedvirtual

Implements Behavior.

Definition at line 12 of file pointing.cpp.

◆ RecognitionOrder

class RecognitionOrder

Definition at line 12 of file recognitionOrder.h.

+ Inheritance diagram for RecognitionOrder:

Public Member Functions

 RecognitionOrder (yarp::os::Mutex *mut, yarp::os::ResourceFinder &rf, icubclient::ICubClient *iCub, std::string behaviorName)
 
void configure ()
 
- Public Member Functions inherited from Behavior
 Behavior (yarp::os::Mutex *_mut, yarp::os::ResourceFinder &_rf, icubclient::ICubClient *_iCub, std::string _behaviorName)
 
 Behavior ()=delete
 No default constructor! More...
 
virtual ~Behavior ()
 
void openPorts (std::string port_name_prefix)
 openPorts open ports defined for a behavior More...
 
bool trigger (const yarp::os::Bottle &args)
 trigger triggers this behavior and blocks the mutex More...
 
void interrupt_ports ()
 interrupt_ports interrupt ports defined for a behavior More...
 
void close_ports ()
 close_ports close ports defined for a behavior More...
 

Public Attributes

bool manual
 
- Public Attributes inherited from Behavior
yarp::os::Port rpc_out_port
 Port to external module. More...
 
std::string behaviorName
 
std::string from_sensation_port_name
 
std::string external_port_name
 
yarp::os::BufferedPort< yarp::os::Bottle > sensation_port_in
 Input port from sensationManager. More...
 

Protected Member Functions

void run (const yarp::os::Bottle &args)
 
void close_extra_ports ()
 

Additional Inherited Members

- Protected Attributes inherited from Behavior
icubclient::ICubClientiCub
 
yarp::os::ResourceFinder & rf
 

Constructor & Destructor Documentation

◆ RecognitionOrder()

RecognitionOrder::RecognitionOrder ( yarp::os::Mutex *  mut,
yarp::os::ResourceFinder &  rf,
icubclient::ICubClient iCub,
std::string  behaviorName 
)
inline

Definition at line 27 of file recognitionOrder.h.

Member Function Documentation

◆ close_extra_ports()

void RecognitionOrder::close_extra_ports ( )
inlineprotectedvirtual

Implements Behavior.

Definition at line 21 of file recognitionOrder.h.

◆ configure()

void RecognitionOrder::configure ( )
virtual

Implements Behavior.

Definition at line 6 of file recognitionOrder.cpp.

◆ run()

void RecognitionOrder::run ( const yarp::os::Bottle &  args)
protectedvirtual

Implements Behavior.

Definition at line 15 of file recognitionOrder.cpp.

Member Data Documentation

◆ manual

bool RecognitionOrder::manual

Definition at line 32 of file recognitionOrder.h.

◆ Tagging

class Tagging

Definition at line 13 of file tagging.h.

+ Inheritance diagram for Tagging:

Public Member Functions

 Tagging (yarp::os::Mutex *mut, yarp::os::ResourceFinder &rf, icubclient::ICubClient *iCub, std::string behaviorName)
 
void configure ()
 
- Public Member Functions inherited from Behavior
 Behavior (yarp::os::Mutex *_mut, yarp::os::ResourceFinder &_rf, icubclient::ICubClient *_iCub, std::string _behaviorName)
 
 Behavior ()=delete
 No default constructor! More...
 
virtual ~Behavior ()
 
void openPorts (std::string port_name_prefix)
 openPorts open ports defined for a behavior More...
 
bool trigger (const yarp::os::Bottle &args)
 trigger triggers this behavior and blocks the mutex More...
 
void interrupt_ports ()
 interrupt_ports interrupt ports defined for a behavior More...
 
void close_ports ()
 close_ports close ports defined for a behavior More...
 

Protected Member Functions

void run (const yarp::os::Bottle &args)
 
void close_extra_ports ()
 

Additional Inherited Members

- Public Attributes inherited from Behavior
yarp::os::Port rpc_out_port
 Port to external module. More...
 
std::string behaviorName
 
std::string from_sensation_port_name
 
std::string external_port_name
 
yarp::os::BufferedPort< yarp::os::Bottle > sensation_port_in
 Input port from sensationManager. More...
 
- Protected Attributes inherited from Behavior
icubclient::ICubClientiCub
 
yarp::os::ResourceFinder & rf
 

Constructor & Destructor Documentation

◆ Tagging()

Tagging::Tagging ( yarp::os::Mutex *  mut,
yarp::os::ResourceFinder &  rf,
icubclient::ICubClient iCub,
std::string  behaviorName 
)
inline

Definition at line 22 of file tagging.h.

Member Function Documentation

◆ close_extra_ports()

void Tagging::close_extra_ports ( )
inlineprotectedvirtual

Implements Behavior.

Definition at line 17 of file tagging.h.

◆ configure()

void Tagging::configure ( )
virtual

Implements Behavior.

Definition at line 7 of file tagging.cpp.

◆ run()

void Tagging::run ( const yarp::os::Bottle &  args)
protectedvirtual

Implements Behavior.

Definition at line 12 of file tagging.cpp.