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

Creating and building ros worksapce in QT creator?

asked 2020-11-05 12:37:49 -0600

Eman.m gravatar image

updated 2020-11-05 12:38:41 -0600

Hello

I created a ROS workspace using QT creator:

First, I created a directory ros_ws in my HOME directory. Then, in QT creator: File ==> new Project ==> ROS Workspace ==> I wrote the project name testROS and Workspace Path to be ros_ws directory that I created.

The resulted files inside ros_ws directory is the file testROS.workspace When I choose Build ==> Build Project “testROS” It gave message [ROS Warning] Failed to source workspace because this file does not exist: /home/eman/ros_ws/devel/setup.bash.

The resulted folders inside ros_ws directory are: build, devel, install, logs, src, .catkin_tools, But the CmakeLists.txt is not created inside src folder (which what usually happens when running catkin_make command in terminal).

My questions are:

  • why the warning message appear?

  • why CmakeLists.txt is not created inside src folder as with catkin_make? Thanks a lot in advance

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-11-05 13:17:33 -0600

jschornak gravatar image

I assume that you're using the ROS-Industrial Qt Creator plugin.

When you configure the project there is an option to select which build system to use, and for ROS1 this choice is usually between CatkinMake and CatkinTools. Since your built workspace contains a .catkin_tools directory, this means your project is configured to build using CatkinTools, which does not create a top-level CMakeLists.txt file in the workspace.

If you would like to change which build system the Qt Creator ROS plugin uses for an already-imported workspace, the setting is on the Projects --> Build Settings page:

image description

As far as the warnings go, I've found that the messages printed in the "General Messages" display are usually not very helpful in the context of ROS workspaces, and even if some warnings print there the project may have built successfully. You should look in the "Compile Output" display for info related to the success or failure of your build. I think the particular warning you provided appears when you build a clean workspace for the first time, since the devel directory isn't present at that point.

edit flag offensive delete link more

Comments

Many Thanks...When I changed the build system to CatkinMake, the CMakeLists.txt appears inside src, But it does not appear in the QT Creator's project view hierarchy (at the left of QT Creator). I tried to right click src folder ==> Add existing file ==> select CMakeLists.txt, But it is also not shown in the project view.

Also, in the Terminal, when I run the command echo $ROS_PACKAGE_PATH, my workspace is not shown as the first one. I also created a new package under the src, But nothing appear under src even though include,src, package.xml, CMakeLists.txt physically exist in the folder.

Eman.m gravatar image Eman.m  ( 2020-11-05 15:11:00 -0600 )edit

For the issues with missing files and directories, closing and reopening the project within Qt Creator. I've noticed that it sometimes does not dynamically add new files and directories to the project view (for example, when cloning in a new package repository).

For the issue with ROS_PACKAGE_PATH, did you source the newly-built workspace from the terminal?

jschornak gravatar image jschornak  ( 2020-11-06 10:50:19 -0600 )edit

For ROS_PACKAGE_PATH, many thanks, it works after sourcing

If I close the project: File => close project.

Then, File => Open File or Project ==> which file I have to choose to open the project?

Eman.m gravatar image Eman.m  ( 2020-11-06 11:17:14 -0600 )edit

If your project is listed under the File => Recent Projects, you can re-open it that way. From the "Open File or Project" menu, you need to select the .workspace file at the top level of your workspace. For example, one of mine is located at ~/melodic_ws/melodic_ws.workspace.

jschornak gravatar image jschornak  ( 2020-11-06 11:23:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-05 12:37:49 -0600

Seen: 725 times

Last updated: Nov 05 '20