Ask Your Question
4

Debugging using ROS Qt Creator Plugin

asked 2018-04-27 02:42:35 -0600

alex_ gravatar image

Hi,

I'm with ROS since two weeks and i couldn't figure out yet how to set up QT Creator to automatically attach the debugger after pressing F5.

In my case, after pressing F5, the node is starting in the ROS Terminal as supposed but I expect also the Debugger to attach and if there are Breakpoints set it should stop there.

My workaround is to "Attach to running application" which works fine, but in this case I cannot debug Initialisation code because is is already processed. The "Attach to unstarted application" is also working, but also here it doesn't stop in initialisation code either.

My questions are: How do I set up Qt Creator to automatically attach to the application by pressing F5? How can I set it up to process breakpoints already from the first line of code?

Thanks in advance Alex

edit retag flag offensive close merge delete

Comments

I'm also interested in this question.

harderthan gravatar imageharderthan ( 2018-07-18 20:50:54 -0600 )edit

I could 'nt figure it out yet. To debug initialisation i put an while(1) loop at the beginning and jump over it after i attached manually. It's really anoying

alex_ gravatar imagealex_ ( 2018-07-19 08:57:45 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-23 07:52:56 -0600

updated 2018-10-24 07:22:12 -0600

Hello guys,

I've suffered from the same problem until discovering a pretty clear way to do it. First, we have to configure the project "build" and "run" parameters that can be accessed through the section "Projects" in the right sidebar.

"Projects" section

After access the "Projects" section, we need to set up all parameters related to the build process as the following steps:

1) Remove the current catkin_make configuration (this configuration is just an execution of the conventional process that we are already used to). To remove it just hover your arrow near "Details", hence an "X" will appear.

remove catkin_make

2) After removing the current build step configuration, click on "Add build step" and choose the option "Custom Process Step" and fill the blanks according to your workspace environment.

image description

Above I filled in the blanks considering the tips I found here and my workspace build directory location (in order to have it already done at this step you have to run the "catkin_make" command at least once before it). In my case, my build directory is located at /home/matheus/rosworks/build.

Moreover, the arguments that I used were:

../src -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel -DCMAKE_BUILD_TYPE=Debug.

Notice that the -DCMAKE_BUILD_TYPE=Debug CMake argument is used aiming to allow us to attach to the ROS application in runtime.

4) Once the MakeFile is generated by the CMake, we are able to run the make command, to achieve it we must add other "Custom Process Step".

image description

Above, the argument ''-j12" specifies the number of process to run simultaneously.

If an application requires an install step, other "Custom Process Step" with a make command and install argument can be added.

5) Now, you should be able to build your project. To accomplish it easier we can type ctrl+b to build and afterwards alt+4 to keep up with the compilation.

Now, in order to perform the debug just pressing F5 we need to configure the "run" section of the IDE. For it, follow the next steps:

1) On the "Project" section select the "run" tab.

image description

2) Click on "Add" and then on "Custom Executable".

image description

3) Now, add the path to your ROS executable that probably is placed in your_workspace/devel/lib/your_package_name and the path to your build directory as well.

image description

Congratulations!!

Now you must be able to set up your breakpoints and press F5 to debug your ROS application.

Please, if it was useful for anyone or if you still have a remaining doubt, please let me know that.

Best regards for all.

edit flag offensive delete link more

Comments

awesome... b

harderthan gravatar imageharderthan ( 2018-12-14 06:11:48 -0600 )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: 2018-04-27 02:42:35 -0600

Seen: 755 times

Last updated: Oct 24 '18