Ask Your Question
5

Creating a GUI for ROS

asked 2011-10-23 05:18:09 -0500

ParkerGibbons gravatar image

updated 2014-01-28 17:10:37 -0500

ngrennan gravatar image

Hello,

I am a high school student working on a project to submit to an affiliate competition of the Intel International Science and Engineering Fair. I am trying to create a graphic user interface for ROS to make it even easier for hobbyists and schools to start working on robotics. I am testing it on a turtlebot. Essentially, it will allow you an area to download libraries as well as control the robot. I want to know how you guys think I should go about this. Is there a way to have a 'click' on the screen translate into a written command for the terminal? Thanks for any help you can give!

-Parker Gibbons

edit retag flag offensive close merge delete

6 Answers

Sort by » oldest newest most voted
2

answered 2011-10-23 22:57:30 -0500

updated 2011-10-25 01:23:54 -0500

Almost all ros command line capabilities are available in ros python APIs like roslib, rospy, rosparam, rosnode, etc. So a good start point could be wxwidget for python.

If you don't want to use the python APIs you can invoke processes through the python os.system method or te subproccess library.

edit flag offensive delete link more

Comments

I second this, since wxWidgets is already in ROS (C++ at least), so less dependencies. Also, I like wxWidgets :)
LiMuBei gravatar imageLiMuBei ( 2011-10-24 06:27:05 -0500 )edit
I would suggest using Qt instead (there's also PyQt). It has a nicer API and afaik most wx code in ROS is being ported to Qt (or at least it is planned to).
AHornung gravatar imageAHornung ( 2011-10-25 04:04:03 -0500 )edit
@Pablo Iñigo Blasco : Fully agree with you, I would have started with wx python or probably pygame
Arkapravo gravatar imageArkapravo ( 2011-11-05 05:43:45 -0500 )edit
2

answered 2011-10-25 04:06:35 -0500

AHornung gravatar image

There is a "handoff" ticket for porting rxplot to Qt, I think this could also be a good starting point to get into ROS GUI development: https://code.ros.org/trac/ros/ticket/3220

edit flag offensive delete link more
1

answered 2011-11-24 05:12:46 -0500

Filip gravatar image

Hi, I don't know if you are still interested in programming a gui. If so, maybe we can share experiences. For my thesis I create a Graphical launchfile-editor, which is growing to a development environment. The project is written in C++ and Qt and and is not yet officially released. Visit http://code.google.com/p/rxdeveloper-ros-pkg/ for more information.

edit flag offensive delete link more

Comments

@Filip, I expect there's several people who would be interested in your project. I suggest that you announce it on the ros-users mailing list and ask if others are interested in joining your development effort.
tfoote gravatar imagetfoote ( 2011-11-24 07:30:28 -0500 )edit
@tfoote, I will announce it soon, but I need to create a video tutorial first. I guess it's better to present a more complete project. Stay tuned ;)
Filip gravatar imageFilip ( 2011-11-24 20:05:43 -0500 )edit
1

answered 2011-10-24 01:52:55 -0500

DimitriProsser gravatar image

updated 2011-10-24 01:53:11 -0500

You could also use either Qt (C++), GTK+ in C, or GTKmm (a C++ port for GTK+). There are examples of using Qt in the eros stack here. There's also a good example of using GTK+ with ROS here. Personally, I have used GTKmm for my GUI development in ROS.

Additionally, there is a GTK+ port for Python here.

edit flag offensive delete link more

Comments

The qt roscreate templates have been spun off from eros into their own stack - [qt_ros](http://www.ros.org/wiki/qt_ros). They set up a c++ qt-ros package...might be nice to have them also do pyqt packages as well.
Daniel Stonier gravatar imageDaniel Stonier ( 2011-11-05 19:00:11 -0500 )edit
0

answered 2011-11-24 20:30:39 -0500

If you are writing in C++ you can use fork and execlp to run a system command such as rosrun or roslaunch:

// this code would be called from the callback method of your button
pid_t pid = 0;
pid = fork();
if (pid < 0) {
  ROS_ERROR("Process failed to fork");
  exit(-1);
}
else if (pid == 0) { // Child process
  execlp( "roslaunch", "roslaunch", "launchfolder", "launchfile.launch",NULL);
  // launchfolder is the directory where your launchfile is
  exit(1);
}
else { // parent process
  launchPID = pid;
}

// Kill the started process when exiting the application (in onExit() and/or onClose() callbacks:
if (launchPID) kill(launchPID, 15);

Using system() instead is much easier, but you don't have any control over the processes you created...

edit flag offensive delete link more

Comments

In Qt you can use QProcess, this way you are OS independent.
Filip gravatar imageFilip ( 2011-11-24 22:28:19 -0500 )edit
-1

answered 2018-12-16 21:34:00 -0500

pavankumarbn gravatar image

I have developed a simple GUI to control drone using QtCreater, PyQT, and ROS. You can find it on this link https://github.com/pavankumarbn/Drone... . Also In this video ( https://www.youtube.com/watch?v=CNgfM... ), you can find detailed information on the same.

edit flag offensive delete link more

Comments

Please don't post link-only answers, this leaves the answer to be not self-contained. Please update your answer with the all of the relevant information to answer the question.

jayess gravatar imagejayess ( 2019-01-05 12:13:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2011-10-23 05:18:09 -0500

Seen: 5,603 times

Last updated: Dec 16 '18