Public Slots | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
swri_console::NodeClickHandler Class Reference

#include <node_click_handler.h>

Inheritance diagram for swri_console::NodeClickHandler:
Inheritance graph

Public Slots

void logLevelClicked ()

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event)

Private Member Functions

template<class T >
bool callService (ros::ServiceClient &client, T &service, int timeout_secs=5)
template<class T >
void callServiceWorker (ros::ServiceClient &client, T *service, bool *success)
QMenu * createMenu (const QString &logger_name, const QString &current_level)
bool showContextMenu (QListView *list, QContextMenuEvent *event)

Private Attributes

std::vector< std::string > all_loggers_
ros::NodeHandle nh_
std::string node_name_

Static Private Attributes

static const std::string ALL_LOGGERS = "All Loggers"
static const std::string GET_LOGGERS_SVC = "/get_loggers"
static const std::string SET_LOGGER_LEVEL_SVC = "/set_logger_level"

Detailed Description

Definition at line 50 of file node_click_handler.h.

Member Function Documentation

template<class T >
bool swri_console::NodeClickHandler::callService ( ros::ServiceClient client,
T &  service,
int  timeout_secs = 5 

Attempts to call a ROS service. Will time out and return false if the service call does not return within a specified time.

This is so ugly, but some sort of hack like this is necessary for keeping the UI responsive; ROS service clients do not have any built-in timeout mechanism, so we have to wrap our own around the service call. If we don't, a call to a hanged node could spin forever.

Template Parameters
TType of the ROS service
clientAn initialized ros::ServiceClient
serviceAn instance of the ROS service
timeout_secsThe number of seconds to wait before timing out
true if the service call completed successfully, otherwise false

Definition at line 82 of file node_click_handler.h.

template<class T >
void swri_console::NodeClickHandler::callServiceWorker ( ros::ServiceClient client,
T *  service,
bool *  success 

Used by callService() to actually call the service in another thread.

Definition at line 64 of file node_click_handler.h.

QMenu * swri_console::NodeClickHandler::createMenu ( const QString &  logger_name,
const QString &  current_level 

Definition at line 124 of file node_click_handler.cpp.

bool swri_console::NodeClickHandler::eventFilter ( QObject *  obj,
QEvent *  event 

Definition at line 47 of file node_click_handler.cpp.

void swri_console::NodeClickHandler::logLevelClicked ( )

Definition at line 145 of file node_click_handler.cpp.

bool swri_console::NodeClickHandler::showContextMenu ( QListView *  list,
QContextMenuEvent *  event 

Normally this call should return very quickly, but we don't want the GUI to hang if the roscore is stuck, so add a timeout. The value is pretty arbitrary, but we also want to give enough time for this to still respond over a slow network link, so it shouldn't be too small.

Definition at line 69 of file node_click_handler.cpp.

Member Data Documentation

const std::string swri_console::NodeClickHandler::ALL_LOGGERS = "All Loggers"

Definition at line 101 of file node_click_handler.h.

std::vector<std::string> swri_console::NodeClickHandler::all_loggers_

Definition at line 99 of file node_click_handler.h.

const std::string swri_console::NodeClickHandler::GET_LOGGERS_SVC = "/get_loggers"

Definition at line 102 of file node_click_handler.h.

ros::NodeHandle swri_console::NodeClickHandler::nh_

Definition at line 97 of file node_click_handler.h.

std::string swri_console::NodeClickHandler::node_name_

Definition at line 98 of file node_click_handler.h.

const std::string swri_console::NodeClickHandler::SET_LOGGER_LEVEL_SVC = "/set_logger_level"

Definition at line 103 of file node_click_handler.h.

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

autogenerated on Wed Jun 5 2019 21:25:59