Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
naoqi::Driver Class Reference

Interface for naoqi driver which is registered as a naoqi2 Module, once the external roscore ip is set, this class will advertise and publish ros messages. More...

#include <naoqi_driver.hpp>

Classes

struct  ScheduledConverter
 

Public Member Functions

std::string _whoIsYourDaddy ()
 
void addMemoryConverters (std::string filepath)
 qicli call function to add on-the-fly some memory keys extractors More...
 
 Driver (qi::SessionPtr session, const std::string &prefix)
 Constructor for naoqi driver. More...
 
std::vector< std::string > getAvailableConverters ()
 get all available converters More...
 
float getBufferDuration ()
 
std::vector< std::string > getFilesList ()
 
std::string getMasterURI () const
 qicli call function to get current master uri More...
 
std::vector< std::string > getSubscribedPublishers () const
 get all subscribed publishers More...
 
void init ()
 
std::string minidump (const std::string &prefix)
 Write a ROSbag with the last bufferized data (10s by default) More...
 
std::string minidumpConverters (const std::string &prefix, const std::vector< std::string > &names)
 
void parseJsonFile (std::string filepath, boost::property_tree::ptree &pt)
 
void registerConverter (converter::Converter &conv)
 registers generall converter units they are connected via callbacks to various actions such as record, log, publish More...
 
void registerConverter (converter::Converter conv, publisher::Publisher pub, recorder::Recorder rec)
 register a converter with an associated publisher and recorder More...
 
bool registerEventConverter (const std::string &key, const dataType::DataType &type)
 qicli call function to register a converter for a given memory event More...
 
bool registerMemoryConverter (const std::string &key, float frequency, const dataType::DataType &type)
 qicli call function to register a converter for a given memory key More...
 
void registerPublisher (const std::string &conv_name, publisher::Publisher &pub)
 prepare and register a publisher More...
 
void registerPublisher (converter::Converter conv, publisher::Publisher pub)
 register a converter with an associated publisher instance More...
 
void registerRecorder (const std::string &conv_name, recorder::Recorder &rec, float frequency)
 prepare and register a recorder More...
 
void registerRecorder (converter::Converter conv, recorder::Recorder rec)
 register a converter with an associated recorder instance More...
 
void registerService (service::Service srv)
 registers a service More...
 
void registerSubscriber (subscriber::Subscriber sub)
 registers a subscriber More...
 
void removeAllFiles ()
 
void removeFiles (std::vector< std::string > files)
 
void setBufferDuration (float duration)
 
void setMasterURI (const std::string &uri)
 qicli call function to set current master uri More...
 
void setMasterURINet (const std::string &uri, const std::string &network_interface)
 qicli call function to set current master uri More...
 
void startLogging ()
 
void startPublishing ()
 qicli call function to start/enable publishing all registered publisher More...
 
void startRecording ()
 qicli call function to start recording all registered converter in a ROSbag More...
 
void startRecordingConverters (const std::vector< std::string > &names)
 qicli call function to start recording given topics in a ROSbag More...
 
void startRosLoop ()
 
void stopLogging ()
 
void stopPublishing ()
 qicli call function to stop/disable publishing all registered publisher More...
 
std::string stopRecording ()
 qicli call function to stop recording all registered publisher in a ROSbag More...
 
void stopRosLoop ()
 
void stopService ()
 
 ~Driver ()
 Destructor for naoqi driver, destroys all ros nodehandle and shutsdown all publisher. More...
 

Private Types

typedef std::map< std::string, event::Event >::const_iterator EventConstIter
 
typedef std::map< std::string, event::Event >::iterator EventIter
 
typedef std::map< std::string, publisher::Publisher >::const_iterator PubConstIter
 
typedef std::map< std::string, publisher::Publisher >::iterator PubIter
 
typedef std::map< std::string, recorder::Recorder >::const_iterator RecConstIter
 
typedef std::map< std::string, recorder::Recorder >::iterator RecIter
 

Private Member Functions

template<typename T1 , typename T2 , typename T3 >
void _registerMemoryConverter (const std::string &key, float frequency)
 
void insertEventConverter (const std::string &key, event::Event event)
 
void loadBootConfig ()
 
void registerDefaultConverter ()
 
void registerDefaultServices ()
 
void registerDefaultSubscriber ()
 
void rosLoop ()
 

Private Attributes

boost::property_tree::ptree boot_config_
 
float buffer_duration_
 
std::priority_queue< ScheduledConverterconv_queue_
 
std::vector< converter::Converterconverters_
 
std::map< std::string, event::Eventevent_map_
 
const size_t freq_
 
bool has_stereo
 
bool keep_looping
 
bool log_enabled_
 
boost::mutex mutex_conv_queue_
 
boost::mutex mutex_record_
 
boost::mutex mutex_reinit_
 
boost::scoped_ptr< ros::NodeHandlenhPtr_
 
std::map< std::string, publisher::Publisherpub_map_
 
bool publish_enabled_
 
boost::thread publisherThread_
 
std::map< std::string, recorder::Recorderrec_map_
 
bool record_enabled_
 
boost::shared_ptr< recorder::GlobalRecorderrecorder_
 
const robot::Robotrobot_
 
std::vector< service::Serviceservices_
 
qi::SessionPtr sessionPtr_
 
std::vector< subscriber::Subscribersubscribers_
 
boost::shared_ptr< tf2_ros::Buffertf2_buffer_
 

Detailed Description

Interface for naoqi driver which is registered as a naoqi2 Module, once the external roscore ip is set, this class will advertise and publish ros messages.

Definition at line 65 of file naoqi_driver.hpp.

Member Typedef Documentation

typedef std::map< std::string, event::Event>::const_iterator naoqi::Driver::EventConstIter
private

Definition at line 286 of file naoqi_driver.hpp.

typedef std::map< std::string, event::Event>::iterator naoqi::Driver::EventIter
private

Definition at line 287 of file naoqi_driver.hpp.

typedef std::map< std::string, publisher::Publisher>::const_iterator naoqi::Driver::PubConstIter
private

Definition at line 282 of file naoqi_driver.hpp.

typedef std::map< std::string, publisher::Publisher>::iterator naoqi::Driver::PubIter
private

Definition at line 283 of file naoqi_driver.hpp.

typedef std::map< std::string, recorder::Recorder>::const_iterator naoqi::Driver::RecConstIter
private

Definition at line 284 of file naoqi_driver.hpp.

typedef std::map< std::string, recorder::Recorder>::iterator naoqi::Driver::RecIter
private

Definition at line 285 of file naoqi_driver.hpp.

Constructor & Destructor Documentation

naoqi::Driver::Driver ( qi::SessionPtr  session,
const std::string &  prefix 
)

Constructor for naoqi driver.

Parameters
session[in]session pointer for naoqi2 service registration

Definition at line 118 of file naoqi_driver.cpp.

naoqi::Driver::~Driver ( )

Destructor for naoqi driver, destroys all ros nodehandle and shutsdown all publisher.

Definition at line 140 of file naoqi_driver.cpp.

Member Function Documentation

template<typename T1 , typename T2 , typename T3 >
void naoqi::Driver::_registerMemoryConverter ( const std::string &  key,
float  frequency 
)
inlineprivate

Definition at line 261 of file naoqi_driver.hpp.

std::string naoqi::Driver::_whoIsYourDaddy ( )
inline

Definition at line 149 of file naoqi_driver.hpp.

void naoqi::Driver::addMemoryConverters ( std::string  filepath)

qicli call function to add on-the-fly some memory keys extractors

Definition at line 1218 of file naoqi_driver.cpp.

std::vector< std::string > naoqi::Driver::getAvailableConverters ( )

get all available converters

Definition at line 949 of file naoqi_driver.cpp.

float naoqi::Driver::getBufferDuration ( )

Definition at line 417 of file naoqi_driver.cpp.

std::vector< std::string > naoqi::Driver::getFilesList ( )

Definition at line 1373 of file naoqi_driver.cpp.

std::string naoqi::Driver::getMasterURI ( ) const

qicli call function to get current master uri

Returns
string indicating http master uri

Definition at line 968 of file naoqi_driver.cpp.

std::vector< std::string > naoqi::Driver::getSubscribedPublishers ( ) const

get all subscribed publishers

Definition at line 1062 of file naoqi_driver.cpp.

void naoqi::Driver::init ( )

Definition at line 151 of file naoqi_driver.cpp.

void naoqi::Driver::insertEventConverter ( const std::string &  key,
event::Event  event 
)
private

Definition at line 449 of file naoqi_driver.cpp.

void naoqi::Driver::loadBootConfig ( )
private

Definition at line 161 of file naoqi_driver.cpp.

std::string naoqi::Driver::minidump ( const std::string &  prefix)

Write a ROSbag with the last bufferized data (10s by default)

Definition at line 260 of file naoqi_driver.cpp.

std::string naoqi::Driver::minidumpConverters ( const std::string &  prefix,
const std::vector< std::string > &  names 
)

Definition at line 319 of file naoqi_driver.cpp.

void naoqi::Driver::parseJsonFile ( std::string  filepath,
boost::property_tree::ptree &  pt 
)

Definition at line 1209 of file naoqi_driver.cpp.

void naoqi::Driver::registerConverter ( converter::Converter conv)

registers generall converter units they are connected via callbacks to various actions such as record, log, publish

Definition at line 422 of file naoqi_driver.cpp.

void naoqi::Driver::registerConverter ( converter::Converter  conv,
publisher::Publisher  pub,
recorder::Recorder  rec 
)

register a converter with an associated publisher and recorder

Definition at line 456 of file naoqi_driver.cpp.

void naoqi::Driver::registerDefaultConverter ( )
private

Info publisher

LOGS

DIAGNOSTICS

IMU TORSO

IMU BASE

Front Camera

Front Camera

Depth Camera

Stereo Camera

Infrared Camera

Joint States

Laser

Sonar

Audio

TOUCH

Odom

Definition at line 537 of file naoqi_driver.cpp.

void naoqi::Driver::registerDefaultServices ( )
private

Definition at line 942 of file naoqi_driver.cpp.

void naoqi::Driver::registerDefaultSubscriber ( )
private

Definition at line 927 of file naoqi_driver.cpp.

bool naoqi::Driver::registerEventConverter ( const std::string &  key,
const dataType::DataType type 
)

qicli call function to register a converter for a given memory event

Definition at line 1287 of file naoqi_driver.cpp.

bool naoqi::Driver::registerMemoryConverter ( const std::string &  key,
float  frequency,
const dataType::DataType type 
)

qicli call function to register a converter for a given memory key

Definition at line 475 of file naoqi_driver.cpp.

void naoqi::Driver::registerPublisher ( const std::string &  conv_name,
publisher::Publisher pub 
)

prepare and register a publisher

Parameters
conv_namethe name of the converter related to the publisher
pubthe publisher to add

Definition at line 431 of file naoqi_driver.cpp.

void naoqi::Driver::registerPublisher ( converter::Converter  conv,
publisher::Publisher  pub 
)

register a converter with an associated publisher instance

Definition at line 463 of file naoqi_driver.cpp.

void naoqi::Driver::registerRecorder ( const std::string &  conv_name,
recorder::Recorder rec,
float  frequency 
)

prepare and register a recorder

Parameters
conv_namethe name of the converter related to the recorder
recthe recorder to add

Definition at line 441 of file naoqi_driver.cpp.

void naoqi::Driver::registerRecorder ( converter::Converter  conv,
recorder::Recorder  rec 
)

register a converter with an associated recorder instance

Definition at line 469 of file naoqi_driver.cpp.

void naoqi::Driver::registerService ( service::Service  srv)

registers a service

Parameters
serviceto register
See also
Service
Note
it will be called by value to expose that internally there will be a copy, eventually this should be replaced by move semantics C++11

Definition at line 936 of file naoqi_driver.cpp.

void naoqi::Driver::registerSubscriber ( subscriber::Subscriber  sub)

registers a subscriber

Parameters
subscriberto register
See also
Subscriber
Note
it will be called by value to expose that internally there will be a copy, eventually this should be replaced by move semantics C++11

Definition at line 906 of file naoqi_driver.cpp.

void naoqi::Driver::removeAllFiles ( )

Definition at line 1388 of file naoqi_driver.cpp.

void naoqi::Driver::removeFiles ( std::vector< std::string >  files)

Definition at line 1401 of file naoqi_driver.cpp.

void naoqi::Driver::rosLoop ( )
private

Definition at line 179 of file naoqi_driver.cpp.

void naoqi::Driver::setBufferDuration ( float  duration)

Definition at line 404 of file naoqi_driver.cpp.

void naoqi::Driver::setMasterURI ( const std::string &  uri)

qicli call function to set current master uri

Parameters
stringin form of http://<ip>:11311

Definition at line 973 of file naoqi_driver.cpp.

void naoqi::Driver::setMasterURINet ( const std::string &  uri,
const std::string &  network_interface 
)

qicli call function to set current master uri

Parameters
stringin form of http://<ip>:11311
network_interfacethe network interface ("eth0", "tether" ...)

Definition at line 978 of file naoqi_driver.cpp.

void naoqi::Driver::startLogging ( )

Definition at line 1176 of file naoqi_driver.cpp.

void naoqi::Driver::startPublishing ( )

qicli call function to start/enable publishing all registered publisher

Definition at line 1044 of file naoqi_driver.cpp.

void naoqi::Driver::startRecording ( )

qicli call function to start recording all registered converter in a ROSbag

Definition at line 1078 of file naoqi_driver.cpp.

void naoqi::Driver::startRecordingConverters ( const std::vector< std::string > &  names)

qicli call function to start recording given topics in a ROSbag

Definition at line 1103 of file naoqi_driver.cpp.

void naoqi::Driver::startRosLoop ( )

Definition at line 1186 of file naoqi_driver.cpp.

void naoqi::Driver::stopLogging ( )

Definition at line 1181 of file naoqi_driver.cpp.

void naoqi::Driver::stopPublishing ( )

qicli call function to stop/disable publishing all registered publisher

Definition at line 1053 of file naoqi_driver.cpp.

std::string naoqi::Driver::stopRecording ( )

qicli call function to stop recording all registered publisher in a ROSbag

Definition at line 1157 of file naoqi_driver.cpp.

void naoqi::Driver::stopRosLoop ( )

Definition at line 1198 of file naoqi_driver.cpp.

void naoqi::Driver::stopService ( )

Definition at line 171 of file naoqi_driver.cpp.

Member Data Documentation

boost::property_tree::ptree naoqi::Driver::boot_config_
private

Definition at line 252 of file naoqi_driver.hpp.

float naoqi::Driver::buffer_duration_
private

Definition at line 292 of file naoqi_driver.hpp.

std::priority_queue<ScheduledConverter> naoqi::Driver::conv_queue_
private

Priority queue to process the publishers according to their frequency

Definition at line 311 of file naoqi_driver.hpp.

std::vector< converter::Converter > naoqi::Driver::converters_
private

Definition at line 278 of file naoqi_driver.hpp.

std::map< std::string, event::Event > naoqi::Driver::event_map_
private

Definition at line 281 of file naoqi_driver.hpp.

const size_t naoqi::Driver::freq_
private

Definition at line 245 of file naoqi_driver.hpp.

bool naoqi::Driver::has_stereo
private

Definition at line 243 of file naoqi_driver.hpp.

bool naoqi::Driver::keep_looping
private

Definition at line 242 of file naoqi_driver.hpp.

bool naoqi::Driver::log_enabled_
private

Definition at line 241 of file naoqi_driver.hpp.

boost::mutex naoqi::Driver::mutex_conv_queue_
private

Definition at line 275 of file naoqi_driver.hpp.

boost::mutex naoqi::Driver::mutex_record_
private

Definition at line 276 of file naoqi_driver.hpp.

boost::mutex naoqi::Driver::mutex_reinit_
private

Definition at line 274 of file naoqi_driver.hpp.

boost::scoped_ptr<ros::NodeHandle> naoqi::Driver::nhPtr_
private

Definition at line 273 of file naoqi_driver.hpp.

std::map< std::string, publisher::Publisher > naoqi::Driver::pub_map_
private

Definition at line 279 of file naoqi_driver.hpp.

bool naoqi::Driver::publish_enabled_
private

Definition at line 239 of file naoqi_driver.hpp.

boost::thread naoqi::Driver::publisherThread_
private

Definition at line 246 of file naoqi_driver.hpp.

std::map< std::string, recorder::Recorder > naoqi::Driver::rec_map_
private

Definition at line 280 of file naoqi_driver.hpp.

bool naoqi::Driver::record_enabled_
private

Definition at line 240 of file naoqi_driver.hpp.

boost::shared_ptr<recorder::GlobalRecorder> naoqi::Driver::recorder_
private

Definition at line 249 of file naoqi_driver.hpp.

const robot::Robot& naoqi::Driver::robot_
private

Definition at line 237 of file naoqi_driver.hpp.

std::vector< service::Service > naoqi::Driver::services_
private

Definition at line 290 of file naoqi_driver.hpp.

qi::SessionPtr naoqi::Driver::sessionPtr_
private

Definition at line 235 of file naoqi_driver.hpp.

std::vector< subscriber::Subscriber > naoqi::Driver::subscribers_
private

Definition at line 289 of file naoqi_driver.hpp.

boost::shared_ptr<tf2_ros::Buffer> naoqi::Driver::tf2_buffer_
private

tf2 buffer that will be shared between different publishers/subscribers This is only for performance improvements

Definition at line 316 of file naoqi_driver.hpp.


The documentation for this class was generated from the following files:


naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 15 2020 03:24:26