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
[legend]

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

◆ callService()

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

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
Parameters
clientAn initialized ros::ServiceClient
serviceAn instance of the ROS service
timeout_secsThe number of seconds to wait before timing out
Returns
true if the service call completed successfully, otherwise false

Definition at line 82 of file node_click_handler.h.

◆ callServiceWorker()

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

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

Definition at line 64 of file node_click_handler.h.

◆ createMenu()

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

Definition at line 124 of file node_click_handler.cpp.

◆ eventFilter()

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

Definition at line 47 of file node_click_handler.cpp.

◆ logLevelClicked

void swri_console::NodeClickHandler::logLevelClicked ( )
slot

Definition at line 145 of file node_click_handler.cpp.

◆ showContextMenu()

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

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

◆ ALL_LOGGERS

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

Definition at line 101 of file node_click_handler.h.

◆ all_loggers_

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

Definition at line 99 of file node_click_handler.h.

◆ GET_LOGGERS_SVC

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

Definition at line 102 of file node_click_handler.h.

◆ nh_

ros::NodeHandle swri_console::NodeClickHandler::nh_
private

Definition at line 97 of file node_click_handler.h.

◆ node_name_

std::string swri_console::NodeClickHandler::node_name_
private

Definition at line 98 of file node_click_handler.h.

◆ SET_LOGGER_LEVEL_SVC

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

Definition at line 103 of file node_click_handler.h.


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


swri_console
Author(s): P. J. Reed , Jerry Towler , David Anthony
autogenerated on Sat Sep 23 2023 02:55:37