0
$\begingroup$

Rosanswers logo

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.


Originally posted by trianta2 on ROS Answers with karma: 293 on 2013-10-31

Post score: 5


Original comments

Comment by lindzey on 2013-10-31:
I'm a happy emacs user, but am interested to see the discussion here. I assume you've already found This wiki page, and this question with a broader focus on IDEs, including some who love QTCreator.

Comment by lindzey on 2013-10-31:
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!)

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by autonomy with karma: 435 on 2013-11-01

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by trianta2 on 2013-11-01:
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?

Comment by trianta2 on 2013-11-01:
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?

Comment by autonomy on 2013-11-01:
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.

Comment by trianta2 on 2013-11-01:
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?

Comment by trianta2 on 2013-11-01:
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!

Comment by autonomy on 2013-11-01:
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.

Comment by trianta2 on 2013-11-01:
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.

Comment by trianta2 on 2013-11-01:
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/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.