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

Putting It Together: Where Do IDEs Come In With ROS Development?

asked 2013-10-31 11:13:13 -0600

trianta2 gravatar image

updated 2014-01-28 17:18:25 -0600

ngrennan gravatar image

Hi,

I went through the tutorials and I feel like I have a good understanding for ROS.

I want to develop my own nodes and packages now. I installed QTCreator and I've been able to load/compile the beginner tutorials project.

However, now I'm trying to put this all together. If one wants to create arbitrarily complex classes/nodes/packages/meta-packages...

  • Do you always have to first make your package with catkin via terminal, and then open the project in QTCreator (or whatever your IDE is)?
  • Do you always have to manually edit your CMakeList files to include the correct dependencies and whatnot?
  • What happens when I want to debug a particular node that, for example, subscribes to some arbitrary topic? How can I possibly create that debugging environment from within QTCreator? Do I need to start with $roscore in terminal and then somehow get the debug session from QTCreator to talk to the master?
  • What happens when I start stacking all these dependencies between nodes and I want to debug them together?

I suppose I'm having difficulty seeing the "big picture". Where does the IDE come into play?

Thanks for your help.

edit retag flag offensive close merge delete

Comments

I'm a happy emacs user, but am interested to see the discussion here. I assume you've already found [This](http://wiki.ros.org/IDEs) wiki page, and [this question](http://answers.ros.org/question/9068/which-ides-do-ros-developers-use/) with a broader focus on IDEs, including some who love QTCreator.

lindzey gravatar image lindzey  ( 2013-10-31 22:03:52 -0600 )edit
1

Sorry - one more comment - if you're a ROS newbie, it might make sense to *start* with emacs or vim since there's lots of information out there assuming you're using terminal + text editor, and when you get more comfortable, figure out how to set up your IDE of choice (and document it on the wiki!)

lindzey gravatar image lindzey  ( 2013-10-31 22:06:17 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
5

answered 2013-11-01 01:46:19 -0600

autonomy gravatar image

updated 2013-11-01 08:36:45 -0600

Just like with any code development, IDEs are not necessary, but they are a very powerful tool and help you save time. I've been using QTCreator for some time and there's no way I will go back to things like hunting down the file which contains compilation errors (double click on the error to go to that line), not having code autocompletion, and manual debugging via GDB. Linux purists may scoff at me, but this stuff lets me write better code by not wasting my time on the things that should be easy anyway.

Now, to answer your specific questions:

  1. Theoretically, no, but catkin makes it easier. You do need to have the usual ROS files like CMakeLists.txt and manifest.xml in place - you can create these by hand or copy/paste and edit from a different project. However, the catkin buildsystem creates many more directories than rosbuild, so you're better off creating your package via catkin first.

  2. Yes. This is how you tell the buildsystem what your compilables and dependencies are, and where to look for them. Otherwise, the compiler/linker won't know what to do.

3 & 4. I do it the way you described with a combination of ROS_WARN/ROS_DEBUG printouts. I find this much easier than dealing with gdb directly and it is very similar, though not as powerful to Visual Studio's debugger.

I think it would be pretty hard to debug multiple nodes simultaneously. What you would do is simulate/replay your inputs and then debug one node at a time. See this and this answers for a way to use QTCreator. In general, you would run everything but the node you are trying to debug from the command line. Having set up QTCreator (in Projects->Run set your executable and command line parameters appropriately), you can then simply set your breakpoints and click on the debug button.

Edit: To answer about multiple mains - go to Projects in QtCreator and click on Run (note: I guess it's important to mention that QtCreator has to be started from a terminal in which the ROS environment is setup, I have the usual ROS setup in my ~/.bashrc file and then launch via qtcreator CMakeLists.txt&)

QtCreator is smart enough to pick up the executables in your project (I believe it's doing it by reading the CMakeLists file). You can pick the exec you want to run from the list or you can add a path to any other exec. Here, I want to run prosilica_node from a specific directory:

image description

Now, if you have some other parameters to set: here in the arguments field I am remapping 2 topics. In addition, I am forcing this node to run in the /robot namespace by setting the ROS_NAMESPACE variable to robot

image description

Just open one of the existing stacks in QtCreator and look around in the Projects view. You should be able to change all of these yourself. Hope this helps.

edit flag offensive delete link more

Comments

Hi Autonomy, Since you can have multiple nodes in a package, and each node is a main(), how do you tell QtCreator which main() to actually execute when you run?

trianta2 gravatar image trianta2  ( 2013-11-01 07:40:03 -0600 )edit

Also, is it possible to have rosmaster up and running, and then having the debug session from within QtCreator interact with rosmaster? How would one go about doing that?

trianta2 gravatar image trianta2  ( 2013-11-01 07:42:09 -0600 )edit
1

I'm not sure I understand your second point - you mean roscore, and subscribing/publishing, correct? If so, then running your debug session from within QtCreator is no different than running it from the command line.

autonomy gravatar image autonomy  ( 2013-11-01 08:07:05 -0600 )edit

I have been having difficulty getting my talker (from the beginner tutorials) to register with rosmaster. I have my terminal (in QtCreator options) set to "/usr/bin/xterm -e" is this a problem?

trianta2 gravatar image trianta2  ( 2013-11-01 08:09:14 -0600 )edit

I ran QtCreator from terminal (so ROS has now been sourced), then set my terminal within QtCreator to "gnome-terminal -e", and now I can run both my listener and talker from QtCreator! I can even interact with them via separate terminal!

trianta2 gravatar image trianta2  ( 2013-11-01 08:15:35 -0600 )edit

Glad you got it working. Out of curiosity, where is the terminal setting? I usually source the ROS setup.sh file in my ~/.bashrc and also export ROS_PACKAGE_PATH in there, so all my terminals work.

autonomy gravatar image autonomy  ( 2013-11-01 08:35:00 -0600 )edit

I found the terminal setting in Tools (the top main bar that keeps auto-hiding annoyingly), Options, Environment.. under the General tab you will see the Terminal field.

trianta2 gravatar image trianta2  ( 2013-11-01 08:40:12 -0600 )edit

By the way, thank you for your thorough answer in the edit above. Feel free to look at my other question ;) http://answers.ros.org/question/96921/design-question-where-does-the-business-logic-go/

trianta2 gravatar image trianta2  ( 2013-11-01 08:40:55 -0600 )edit
0

answered 2013-10-31 22:18:36 -0600

Thomas gravatar image

I think most of the ROS developer are not using an IDE to develop. Personally, I am using emacs but there is also a lot of vim users around me.

So the answer to your question is:

  • I open the file I need in emacs
  • Yes. Writing your CMakeLists.txt manually help you prune the unnecessary dependencies.
  • To debug, I use rxconsole (or rqt in Hydro) and I write launch file with test scenarii to help the process. Then I log using rosbag or I play around using the service and message introspection tools to help me understand what is going on. Of course classical tools such as gdb and valgrind also comes handy.
    • Each node should be first tested separately. If you provide the right input (using a rosbag or rostopic pub) then you can check that the output is correct. Then you can have different launch files aggregating slowly more and more components.

On the other side if you want to use an IDE, CMake can generate solution for many popular software. The CMake documentation detail this process. Once this is done, you can use your favorite IDE like usual.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-10-31 11:13:13 -0600

Seen: 2,454 times

Last updated: Nov 01 '13