bipedal locomotion framework
A suite of libraries for achieving bipedal locomotion on humanoid robots
BipedalLocomotion::YarpUtilities Namespace Reference

Helper for YARP library. More...

Classes

class  VectorsCollectionClient
 VectorsCollectionClient is a class that implements that allows to receive a VectorsCollection from a VectorsCollectionServer. More...
 
class  VectorsCollectionServer
 VectorsCollectionServer is a class that implements the VectorsCollectionMetadataService. More...
 

Functions

template<typename T >
convertValue (const yarp::os::Value &value)
 Convert a value in a element of type T. More...
 
template<>
int convertValue< int > (const yarp::os::Value &value)
 Convert a value in a element of type int. More...
 
template<>
double convertValue< double > (const yarp::os::Value &value)
 Convert a value in a element of type double. More...
 
template<>
std::string convertValue< std::string > (const yarp::os::Value &value)
 Convert a value in a element of type string. More...
 
template<>
bool convertValue< bool > (const yarp::os::Value &value)
 Convert a value in a element of type Boolean. More...
 
bool addVectorOfStringToProperty (yarp::os::Property &prop, const std::string &key, const std::vector< std::string > &list)
 Add a vector of string to a property of a given name. More...
 
template<typename T >
bool getElementFromSearchable (const yarp::os::Searchable &config, const std::string &key, T &number)
 Extract a double from a searchable object. More...
 
template<typename T >
bool getVectorFromSearchable (const yarp::os::Searchable &config, const std::string &key, T &vector)
 Extract a vector from searchable. More...
 
template<>
bool getVectorFromSearchable< std::vector< bool > > (const yarp::os::Searchable &config, const std::string &key, std::vector< bool > &vector)
 Extract an std::vector<bool> from searchable. More...
 
template<typename T >
void mergeSigVector (yarp::sig::Vector &vector, const T &t)
 Append a scalar to a vector. More...
 
template<typename T , typename... Args>
void mergeSigVector (yarp::sig::Vector &vector, const T &t, const Args &... args)
 Variadic function used to merge several vectors. More...
 
template<typename... Args>
void sendVariadicVector (yarp::os::BufferedPort< yarp::sig::Vector > &port, const Args &... args)
 Send a variadic vector through a yarp buffered port. More...
 
void populateBottleWithStrings (yarp::os::Bottle &bottle, const std::initializer_list< std::string > &strings)
 Add strings to a bottle. More...
 

Detailed Description

Helper for YARP library.

Function Documentation

◆ convertValue()

template<typename T >
T BipedalLocomotion::YarpUtilities::convertValue ( const yarp::os::Value &  value)

Convert a value in a element of type T.

Parameters
valuethe value that will be converted
Template Parameters
Treturn type
Returns
an element of type T

◆ convertValue< int >()

template<>
int BipedalLocomotion::YarpUtilities::convertValue< int > ( const yarp::os::Value &  value)

Convert a value in a element of type int.

Parameters
valuethe value that will be converted
Returns
an integer

◆ convertValue< double >()

template<>
double BipedalLocomotion::YarpUtilities::convertValue< double > ( const yarp::os::Value &  value)

Convert a value in a element of type double.

Parameters
valuethe value that will be converted
Returns
a double

◆ convertValue< std::string >()

template<>
std::string BipedalLocomotion::YarpUtilities::convertValue< std::string > ( const yarp::os::Value &  value)

Convert a value in a element of type string.

Parameters
valuethe value that will be converted
Returns
a string

◆ convertValue< bool >()

template<>
bool BipedalLocomotion::YarpUtilities::convertValue< bool > ( const yarp::os::Value &  value)

Convert a value in a element of type Boolean.

Parameters
valuethe value that will be converted
Returns
a Boolean

◆ addVectorOfStringToProperty()

bool BipedalLocomotion::YarpUtilities::addVectorOfStringToProperty ( yarp::os::Property &  prop,
const std::string &  key,
const std::vector< std::string > &  list 
)

Add a vector of string to a property of a given name.

Parameters
propyarp property;
keyis the key;
listis the vector of strings that will be added into the property.
Returns
true/false in case of success/failure

◆ getElementFromSearchable()

template<typename T >
bool BipedalLocomotion::YarpUtilities::getElementFromSearchable ( const yarp::os::Searchable &  config,
const std::string &  key,
T &  number 
)

Extract a double from a searchable object.

Parameters
configis the searchable object;
keythe name to check for;
numberis the double.
Returns
true/false in case of success/failure

◆ getVectorFromSearchable()

template<typename T >
bool BipedalLocomotion::YarpUtilities::getVectorFromSearchable ( const yarp::os::Searchable &  config,
const std::string &  key,
T &  vector 
)

Extract a vector from searchable.

Parameters
configis the searchable object;
keythe name to check for;
vectora vector.
Returns
true/false in case of success/failure

◆ getVectorFromSearchable< std::vector< bool > >()

template<>
bool BipedalLocomotion::YarpUtilities::getVectorFromSearchable< std::vector< bool > > ( const yarp::os::Searchable &  config,
const std::string &  key,
std::vector< bool > &  vector 
)

Extract an std::vector<bool> from searchable.

The specialization is required because vector.data() is not defined when vector is an std::vector<bool>

Parameters
configis the searchable object;
keythe name to check for;
vectora std::vector<bool>
Returns
true/false in case of success/failure

◆ mergeSigVector() [1/2]

template<typename T >
void BipedalLocomotion::YarpUtilities::mergeSigVector ( yarp::sig::Vector &  vector,
const T &  t 
)

Append a scalar to a vector.

vector = [vector, t]

Parameters
vectorthe original vector. The new elements will be add at the end of this vector;
tis a container or a scalar. If t is a container it has to be an iterable object (the element has the methods T::begin() and T::end() or the operator[] has to be defined
Warning
If \at does not satisfies the previous assumptions the compilation will fail with a static assertion

◆ mergeSigVector() [2/2]

template<typename T , typename... Args>
void BipedalLocomotion::YarpUtilities::mergeSigVector ( yarp::sig::Vector &  vector,
const T &  t,
const Args &...  args 
)

Variadic function used to merge several vectors.

Parameters
vectorthe original vector. The new elements will be add at the end of this vector;
tis a container or a scalar. If t is a container it has to be an iterable object (the element has the methods T::begin() and T::end()) or the operator[] has to be defined
argslist containing all the vector that will be merged.
Warning
If t does not satisfies the previous assumptions the compilation will fail with a static assertion

◆ sendVariadicVector()

template<typename... Args>
void BipedalLocomotion::YarpUtilities::sendVariadicVector ( yarp::os::BufferedPort< yarp::sig::Vector > &  port,
const Args &...  args 
)

Send a variadic vector through a yarp buffered port.

Parameters
portis a Yarp buffered port
argslist containing all the vector that will be send.

◆ populateBottleWithStrings()

void BipedalLocomotion::YarpUtilities::populateBottleWithStrings ( yarp::os::Bottle &  bottle,
const std::initializer_list< std::string > &  strings 
)

Add strings to a bottle.

Parameters
bottlethis bottle will be filled.
stringslist containing all the string.