QT package, enabling to define topic boxes and assign topic names to them
- Add Qt Text Edit Input Widget to the frame.
- Add dynamic property with the string field "topic_name" to that widget.
- Go to main_window.cpp and add following lines to
MainWindow::MainWindow
constructor
m_qt_name_to_object[ui.topic_viewer->objectName()] = ui.topic_viewer;
m_qnode.addTopicWidget(ui.topic_viewer->objectName(), ui.topic_viewer->property("topic_name").toString(), STATS_DROPPED_MSGS);
-
Change ui.topic_viewer to the name of the object on ui.
-
If the topic have msg_type other than Statistics or Int64, do the following steps:
- Add msg_enum in enum_msg_type.h
- Add callback prototype to qnode.hpp
- Add callback implementation to qnode.cpp, with mandatory
Q_EMIT loggingUpdated(qt_msg)
, where qt_msg is theQPair<Qstring, QString>
of qt object_name on ui and string, that is going to be displayed in box. - Add
ros::subscriber
to theQNode::addTopicwidget
with the pattern presented in INT_64 and STATS_* msg_types, but use your own callback and mgs_type. If you want to monitor topic, then use the pattern in INT_64. If you want to monitor statistics on topic, then use the pattern in STATS* msg_types.
- To enable statistics write
rosparam set /enable_statistics true
in terminal and only after that launch ondes - The information about topic stats will only be published, if there is some node is subscribed to the topic. Seems, we cannot escape that, because this is how ROS works and it is impossible to get statistics from dead leafs(topics with no subscribers).