ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Creating GUI for ROS

asked 2015-08-18 03:25:27 -0500

darshandoria gravatar image

Dear all, i am a pg student working on robotics, i have configured ROS Indigo in my Ubuntu 14.04LTS, also interfaced and drive multiple servo motors using Arduino using ROS package. But till now, to drive servo motor, i was giving command from the terminal window, which i want to drive from the GUI. For this i have created a GUI window in QT, but how to connect this GUI to my ROS package as well as Arduino IDE, i have wasted my lot time to find this. Can anybody help me to find out the solution for this.

I would be very thankful for this task. Thanks in advance

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-08-18 03:40:39 -0500

updated 2015-08-18 03:41:46 -0500

Probably it would be good to make a rqt plugin. These can be done in Python and CPP.

I guess there is no tutorial but just check for the given plugins:

http://wiki.ros.org/rqt_common_plugin...

A good example for a C++ plugin is rqt_imageview, because the most of them are done in python.

edit flag offensive delete link more

Comments

Is it possible to write a program in QT and then combining it with ROS and ARDUINO?

darshandoria gravatar image darshandoria  ( 2015-08-18 05:11:55 -0500 )edit

It is, take a look at the CMakeLists.txt of the rqt_imageviewer plugin for how to include the QT libraries, you do not have to write a plugin. https://github.com/ros-visualization/...

cyborg-x1 gravatar image cyborg-x1  ( 2015-08-18 07:26:00 -0500 )edit
0

answered 2015-08-18 08:32:57 -0500

Simon Schmeisser gravatar image

updated 2015-08-31 03:51:40 -0500

You just need to write a Qt Program like normal using CMake for the build system. http://doc.qt.io/qt-5/cmake-manual.html

Now copy that stuff into a catkin package.

call ros::init somewhere in your code.

Then start a ros::asyncSpinner to receive ros packages (you can publish stuff and call service calls without it, but actionClient calls will never return and you get no callbacks)

Now do everything just like normal (as you did in your command-line version).

if you need callbacks, define the function you want to call as a qt slot, create a wrapper function that calls

QMetaObject::invokeMethod(yourObjectPointer, "functionName", Qt::QueuedConnection);

asyncSpinner will live in a new thread, if you call a Qt function directly from there, thing will go bad. Race conditions etc. Also your application might crash, because you are not allowed to call draw functions from other threads. QueuedConnections creates an Event that is processed later in the main thread.

edit flag offensive delete link more

Comments

Sir, I am very newbie for this work, i only understand till now the tutorials part of ROS, sir can u please explain the steps for this. . .i will be very much thankful and greatful to you. . .

darshandoria gravatar image darshandoria  ( 2015-08-30 23:55:09 -0500 )edit

There are tons of tutorials available also for qt, read those. Then google whatever is unclear in my above answer. Look at the ros and qt manuals. Just try it.

Simon Schmeisser gravatar image Simon Schmeisser  ( 2015-08-31 03:54:11 -0500 )edit

Sir, can i have code for this . . i tried, but having errors.

Also i required code if u can provide.

Thanks in Advance.

darshandoria gravatar image darshandoria  ( 2015-09-13 23:19:13 -0500 )edit

Hi, I want to create a GUI for a turtlebot robot so I have the same issue, when you say "now copy that stuff" , what do you mean exactly? the overall solution that you provide is still the same today? Thank you.

IgnacioArriscado gravatar image IgnacioArriscado  ( 2019-04-10 07:30:06 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-18 03:25:27 -0500

Seen: 2,584 times

Last updated: Aug 31 '15