Publishing/Subscribing from/to Qt GUI to ROS

asked 2014-12-17 16:06:07 -0500

MKI gravatar image

updated 2014-12-17 16:10:25 -0500

Hi,

I am working on qt based GUI tool that I found in ROS wiki. As I understand, this package provides the basic requirement to interface Qt to ROS by means of a QNode class (a Thread). This package template, publishes chatter topic by means of the QNode Thread, using the run method. so my question is, how can one publish/subscribe values from Qt elements like a qSlider, qButton, qLineEdit, qProgressBar... etc to ROS? I am not very familiar with Thread programming, How can I pass these values to the QNode Thread...? PFB is portion of code to get an Idea:

    /*********************
    ** Logging
    **********************/
    ui.view_logging->setModel(qnode.loggingModel());
    QObject::connect(&qnode, SIGNAL(loggingUpdated()), this, SLOT(updateLoggingView()));

/*********************
** Auto Start
**********************/
if ( ui.checkbox_remember_settings->isChecked() ) {
    on_button_connect_clicked(true);
}

/*********************
**

Values That I need to publish

**********************/
ui.linearVelprogressBar->setValue(ui.linearVelhorizontalSlider->value());
ui.angularVelprogressBar->setValue(ui.angularVeldial->value());

connect(ui.linearVelhorizontalSlider,SIGNAL(valueChanged(int)),ui.linearVelprogressBar,SLOT(setValue(int)));
connect(ui.angularVeldial,SIGNAL(valueChanged(int)),ui.angularVelprogressBar,SLOT(setValue(int)));

here is sample GUI...image description

If anyone has worked on this, Please give me an Idea to perform the above... Thanks in advance.

Murali

edit retag flag offensive close merge delete

Comments

This is what i'm looking for. Did you get the answer?

nouf gravatar image nouf  ( 2015-02-18 06:20:18 -0500 )edit

I was not able to find a solution with qt and C++; so I switched over to GLADE+gtk+python for GUI development, it is relatively simpler to understand and quicker to code. There are some issues with this method too ( ~ similar to the one mentioned above); will post the link shortly.

MKI gravatar image MKI  ( 2015-02-26 08:20:19 -0500 )edit