This page collects experience and advice on using integrated development environments (IDEs) with ROS. Please contribute.

General

On ROS Answers there is a thread about Which IDE(s) do ROS developers use? that might have further hints not yet entered here.

Reusing your shell's environment

For building and running ROS programs from inside IDEs, the ROS enviroment has to be set up. All IDEs might have a config for that, but running your IDE from your ROS-sourced shell should be the easiest way, avoiding inconsistency.

Likewise, you can enhance your IDE's launcher icon to load your shells environment. E.g., replace its command eclipse with bash -i -c "eclipse". This will make bash source ~/.bashrc, in which ROS has to be sourced and parameterized, and start that IDE . For convenience, you can also launch it by default like this by changing the Exec= line in your eclipse.desktop launcher (which you need to create manually if you install Eclipse from the Eclipse website directly).

Eclipse

Eclipse's built in C++ indexing capabilities have gotten quite good in recent versions.

Installing Eclipse

To use this tutorial, users should not "sudo apt-get install eclipse". Instead:

Creating the Eclipse project files

For a rosbuild package

CMake can produce Eclipse project files automatically. These project files then set up all include paths correctly, so that auto completion and code browsing will work out of the box.

However, currently, a small hack is required for generating these project files in the right folder. The problem is that ROS creates the Makefiles and all other build artifacts in the build/ folder, but Eclipse expects the source files to be located within (or below) the folder where its project files are stored.

Fortunately, there is now a make target using a small script that circumvents this problem, by forcing CMake to create the project files in the directory of your package (and not the build/ folder). Proceed as follows:

Open a terminal, roscd into the folder of your package, and execute:

make eclipse-project

You will now find two Eclipse files in your package. It is not recommended to add them to the repository, as they contain absolute links and will be different for different users checking out your software.

Note that if you change anything to your manifest.xml, you will have to run this script again, which will overwrite your Eclipse project file and thereby reverting all manual changes to the project settings.

Note: Simply running the cmake Eclipse generator like

cmake -G"Eclipse CDT4 - Unix Makefiles"

will overwrite the Makefile. This can also happen if make eclipse-project does not complete successfully. If you already did this, you will want to restore the original Makefile, which should contain the following line:

include $(shell rospack find mk)/cmake.mk

Creating eclipse files for multiple packages/stacks

Go to the directory where your packages reside (which may be a stack-folder or just a simple folder) and run:

rosmake --target=eclipse-project --specified-only *

If you need to convert deeper nested packages or multiple stacks at once be encouraged to use this eclipse projects bash script for subdirectories.

Catkin-y approach

If you are using catkin, you do not have the possibility to use make eclipse-project. You need to execute:

catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles"

to generate the .project file and then run:

awk -f $(rospack find mk)/eclipse.awk build/.project > build/.project_with_env && mv build/.project_with_env build/.project

to pass the current shell environment into the make process in Eclipse.

After executing this command you will find the project files in the build/ folder. Now you can import your project as existing project into workspace.

Maybe you will need to execute the following if you would like to debug your program. To execute this command cd to the build/ folder. You should do so if you e.g. get an error like "No source available for main()".

cmake ../src -DCMAKE_BUILD_TYPE=Debug

For information on the proper approach using catkin, start here

Catkin and Python

For me, the above procedure didn't generate a .pydevproject file, like make eclipse-project ever did. Clicking Set as PyDev Project would create a config but without any Paths, so coding would be a hassle.

Workaround: From within the package you want to program run:

python $(rospack find mk)/make_pydev_project.py

Now copy the created file .pydevproject (which has all dependency package paths included) to <catkin_ws>/build and import your catkin-project into eclipse or Set it as PyDev Project if already imported.

catkin tools

With the new catkin_tools, there are few changed from the Catkin-y method described above. To generate eclipse-project you need to execute:

catkin build  --force-cmake -G"Eclipse CDT4 - Unix Makefiles" 

to generate the .project files for each package and then run: the follwoing script

ROOT=$PWD 
cd build
for PROJECT in `find $PWD -name .project`; do
    DIR=`dirname $PROJECT`
    echo $DIR
    cd $DIR
    awk -f $(rospack find mk)/eclipse.awk .project > .project_with_env && mv .project_with_env .project
done
cd $ROOT

To debug use the following command and you can mention the name of the package to configure that specific project for debug instead of the entire workspace. Remember to run the script to modify .project to pass the current shell environment into the make process in Eclipse.

catkin build  --force-cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug

Importing the project into Eclipse

Now start Eclipse, select File --> Import --> Existing projects into workspace, hit next, then browse for your package's directory (select root directory). Do NOT select Copy projects into workspace. Then finish.

You should now be able to browse through the code (hold down CTRL while clicking on a function/class name), get auto completion (automatically appears, or press CTRL-SPACE) et cetera.

Fixing unresolved includes

There are many possible reasons why indexing cannot resolve all includes, functions, methods, variables, etc. Often, fixing the resolving of includes solves these errors. If you have any problems, these might be fixed by:

  • If the dependencies of your project have changed since first adding them to Eclipse, regenerate the project files and reimport the project into your workspace.
  • Making sure to load your .bashrc environment with Eclipse, by launching it using bash -i -c "eclipse" (see Reusing your shell's environment).

  • In Eclipse, right click the project, click properties -> C/C++ general -> Preprocessor Include Paths, Macros etc. Click the tab "Providers" and check the box next to "CDT GCC Built-in Compiler Settings [ Shared ]".

  • Afterwards, right click the project, select Index -> Rebuild. This will rebuild your index. Once this is done, usually all includes will resolve.

  • As a last resort, you can also manually add folders that will be searched for headers, using right click project -> properties -> C/C++ Include Paths and Symbols. This is usually not necessary though.

Building the project inside Eclipse

The eclipse-project make target automatically tries to set the environment variables correctly such that building within Eclipse should work out-of-the-box. Especially if you follow Reusing your shell's environment from above.

If not, this is where you need to start looking: Right click on the project, select Properties --> C/C++ Make Project --> Environment, and check whether the following environment variables are assigned to the correct values:

  • ROS_ROOT
  • ROS_PACKAGE_PATH
  • PYTHONPATH
  • PATH

The easiest way to obtain the correct values for your installation is to open a terminal, and run

echo $ROS_ROOT
echo $ROS_PACKAGE_PATH
echo $PYTHONPATH
echo $PATH

You should now be able to compile your package properly, for example by hitting CTRL-B (or selecting Project --> Build project in the menu).

Note: When working with multiple projects, Eclipse won't be able to determine the correct build order or when dependent projects have to be rebuilt. You have to set the project interdependencies manually for each project in your workspace (see http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_pns_ref.htm).

Running and debugging your executables within Eclipse

As for building within Eclipse, the crucial step here is to set the required environment variables correctly in the launch configuration. As the same for building, this should work out-of-the-box, especially if you follow Reusing your shell's environment from above.

Create a new launch configuration, by clicking on Run --> Run configurations... --> C/C++ Application (double click or click on New). Select the correct binary on the main tab (Search project should work when your binary was already built). Then in the environment tab, add (at least)

  • ROS_ROOT
  • ROS_MASTER_URI

again with the values of your installation. If you are unsure about them, open a terminal and run

echo $ROS_ROOT
echo $ROS_MASTER_URI

Finally, if you cannot save the configuration, remove the @ character in the name of the new run configuration.

This should now allow you to run and debug your programs within Eclipse. The output directly goes into the Console of Eclipse. Note that the ROS_INFO macros use ANSI escape sequences, which are not parsed by Eclipse; therefore, the output might look similar to this one (from Writing a Publisher/Subscriber (C++)):

[ INFO] [1276011369.925053237]: I published [Hello there! This is message [0]]
[ INFO] [1276011370.125082573]: I published [Hello there! This is message [1]]
[ INFO] [1276011370.325025148]: I published [Hello there! This is message [2]]
[ INFO] [1276011370.525034947]: I published [Hello there! This is message [3]]

You could use an ANSI console plugin (e.g. http://www.mihai-nita.net/eclipse/) to get rid of the "[0m" characters in the output.

More eclipse goodies

  • Setup a file template that pre-formats whenever a new source or header file is created. The template could for example contain the license header, author name, and include guards (in case of a header file). To setup the templates, choose in the Preferences C/C++->Code Style->Code Templates. For example, to add the license header choose Files->C++ Source File->Default C++ source template and click on Edit.... Paste the license header and click OK. From now on, all source files while automatically contain the license header.

  • Enable Doxygen with the project properties clicking on C/C++ General, enabling project specific settings and selecting Doxygen as Documentation tool. This option automatically completes Doxygen style comments highlights them.

  • People that are used to the emacs key bindings can select emacs-style bindings in Windows->Preferences General->Keys and selecting the emacs Scheme. Also, other useful key bindings (e.g. make project) can easily be added.

  • To also index files that live outside the ROS tree (e.g. the boost include files) you can add them in project properties C/C++ General->Paths and Symbols.

  • The generated eclipse project also works great for Python code. Just install the PyDev plugin for syntax highlighting and code completion.

Auto Formatting

Eclipse also has extensive formatting configuration capabilities. To add the ROS formatting profile to Eclipse, perform the following steps:

  • Download ROS_Format.xml to some location (versions: Indigo Kepler)

  • Start Eclipse
  • Select Window->Preferences->C/C++->Code Style

  • Click Import...

  • Select ROS_format.xml from the location used in step 1

  • Click OK

As you edit a file, Eclipse should use this new profile to format your code following the ROS conventions. To reformat an entire file, select Edit->Format.

CodeBlocks

Here's how to create a ROS package using CodeBlocks:

  • Create a new project as you normally do in CodeBlocks, either as a console project or as a wxWidgets project. Write a manifest.xml file that specifies the ROS dependencies, as you normally do for a ROS package. To get the compiler and the linker flags, use these commands from a terminal window:

      rospack export --lang=cpp --attrib=cflags PackageName
      rospack export --lang=cpp --attrib=lflags PackageName
    You can just copy and paste the results into the Build Options of your project, specifically:
    • In CodeBlocks, right click on the project name, select Build Options, select the project (rather than the Debug or Release versions that are selected by default in the popup window), select the tabs for Compiler Settings, Other Options, and paste the cflags you got from above. Then select the linker settings tab, and in Other Linker Options, paste the linker flags you got from above. You can also do this with a bash script: copy the flags into bash scripts, make them executable, and put the scripts in place of the long lists of flags. You can use environment varialbles in the script. Note that CodeBlocks allows a "local" definition of environment variables as well.

    If you are writing a ROS node, create the msg (and perhaps svr) directory and populate it as you normally do using.
    • `rospack find roscpp`/scripts/genmsg_cpp msg/MessageName.msg

    Then be sure to go back and add -Imgs/cpp (and perhaps -I srv/cpp) flags to the cflags in Compiler Settings, Other Options.

    I posted in the Attachments an example of code that works in a CodeBlocks wxWidgets GUI project and runs a ROS node that subscribes, advertises, services, and publishes data across various busses. The files are nodeTemplate.cpp and nodeTemplate.h

Here's how to use the sample code: . Create a package called wxWidgetsNodeTemplate, using the attached manifest.xml file. Also create a msg directory and a srv directory.

  • Use the attached RosNodeTemplate.msg file and auto-generate the header for it with

  • `rospack find roscpp`/scripts/genmsg_cpp msg/RosNodeTemplate.msg

  • Similarly use the attached NodeTemplateServer,srv file and auto-generate the header for it with

  • `rospack find roscpp`/scripts/gensrv_cpp srv/NodeTemplateServer.srv

  • Now create a CodeBlocks project as detailed above. Add the attached files, nodeTempalte.h and nodeTemplate.cpp to the project.

  • Now make an instance of nodeTemplate, passing it a pointer to a wxTextCtrl:
  • m_pNodeTemplate = new nodeTemplate(txtGeneral);
  • It will listen to monitor_node_bus and write to the textbox when it sees activity on that bus.
  • It will service calls to node_service_bus and write to the textbox when the service is called.
  • You can publish on node_bus_out with
  • m_pNodeTemplate->Publish();

  • .

Emacs

Support through the rosemacs package. Navigate and tab complete the ros package file system, live tracking and tab completion of topics, tracking and notifications when nodes startup/die, etc.

Vim

The most feature-rich Vim plugin for ROS development is vim-ros. It provides :Roscd, :Rosed, and :TabRosed commands with <Tab> completion, manages your &makeprg setting (to allow building with :make), brings syntax highlighting and omni-completion for ROS filetypes (e.g. message descriptions, launch files), facilitates integration with Ultisnips and Syntastic plugins, and whatnot. The plugin is written in Python and, as such, is contribution-friendly.

Alternative support is through the rosvim plugin, from Michael Styer. Drop the file in ~/.vim/plugin.

Extended version of rosvim.vim is here (sorted and implemented <Tab> completion feature), and ctrlp.vim interface of ros.vim is here. You can install these plugins easily by using vimscript installation plugins such as https://github.com/gmarik/vundle and https://github.com/Shougo/neobundle.vim.

A useful complement to these plugins is the YouCompleteMe plugin for code completion. Thanks to a configuration file from Gaƫl Ecorchard (.ycm_extra_conf.py), the include paths are automatically added to the YouCompleteMe configuration for ROS packages.

NetBeans

The NetBeans IDE is written in Java and supports development in Java and many other programming languages. Here, C/C++ development support will be of interest.

Installing NetBeans

Although NetBeans is included in Ubuntu repositories, everything described here was tested with NetBeans 6.9.1.

$ sudo sh netbeans-6.9.1-ml-cpp-linux.sh

Getting ROS environment variables in NetBeans

NetBeans can "import" project from existing sources. It can use Makefiles, and even run configure script or CMake to generate one. But, that kind of automatic project configuration and build would overwrite stub makefile that every ROS package has. That makefile in essence runs ROS build system for a package, and that is what we want NetBeans to do.

In order to use rosmake from NetBeans, we need to set ROS environment variables in NetBeans. Since NetBeans is started with a shell script on Linux, we can include the variables in the script.

In recent ROS (where rosinstall generates setup files for multiple types of shell)

Since from recent versions rosinstall generates setup.sh, setup.bash and setup.zsh (as oposed to just setup.sh which was actually a bash script), there is no need for all the steps that are described in the next section.

The following will suffice to get ROS environment variables to NetBeans:

$ roscd
$ cd ..
$ echo ". $(pwd)/setup.sh" > ~/.netbeans/6.9/etc/netbeans.conf

We don't actually need perks specific to bash.

The exact path of netbeans.conf for the various OS can be found here: http://wiki.netbeans.org/FaqNetbeansConf

In previous ROS

If rosinstall doesn't generate setup files for multiple types of shell, you need to do the following. Since ROS shell tools are for bash, we'll convert NetBeans startup script from sh to bash. Simply edit the first line of NetBeans startup script (located at /usr/bin/netbeans if you installed from the Ubuntu package, or possibly /usr/local/netbeans-6.9.1/bin/netbeans if you installed manually) from

#!/bin/sh

to

#!/bin/bash

Further down the startup script it can be seen that the file ~/.netbeans/6.9/etc/netbeans.conf is included if it exists. We'll create that file like this

$ roscd
$ cd ..
$ echo "source $(pwd)/setup.sh" > ~/.netbeans/6.9/etc/netbeans.conf

Now, it just takes to modify NetBeans .desktop launcher (/usr/share/applications/netbeans-6.9.1.desktop). Change the line

Exec=/bin/sh "/usr/local/netbeans-6.9.1/bin/netbeans"

to

Exec=/bin/bash "/usr/local/netbeans-6.9.1/bin/netbeans"

And that is it. Next time you start NetBeans it will have ROS environment variables, and you'll be able to use e.g. rosmake.

Making NetBeans project

We'll try to setup project for Microstrain 3DM-GX2 IMU driver package, so note it's path:

$ roscd microstrain_3dmgx2_imu
$ pwd
  • Start "C/C++ Project with Existing Sources" wizard
  • Use the above path to "Specify the folder that contains existing sources"
  • Select "Custom" Configuration Mode (note that Automatic Mode recognizes cmake)
  • Proceed with the wizard accepting defaults

You should get a NetBeans project for microstrain_3dmgx2_imu package with automatically configured Code Assistance (and almost working for all dependencies). E.g. you can see that the bullet library headers weren't parsed.

We will configure Code Assistance manually. That means entering paths to all header files the package uses and all preprocessor definitions.

To get the paths to include files for the package we will use rospack. Further, we'll use sed to format them for easier input to NetBeans.

$ rospack cflags-only-I microstrain_3dmgx2_imu | sed 's/ /:/g' -

Open the project properties. Go to Code Assistance -> C++ Compiler and paste the output of the above command to Include Directories field.

Use rospack to find the preprocessor definitions and enter them manually.

$ rospack cflags-only-other microstrain_3dmgx2_imu

Code auto formatting in NetBeans

Following file netbeans-ros-code_style.zip is prepared to enable auto formatting of C++ code in NetBeans as defined in CppStyleGuide. In order to use it, you should import it to Netbeans (Tools -> Options -> Import).

With this, example given in CppStyleGuide#Formatting will be identically formated, except of extra blank lines before function or class definitions. For a discussion see Google C++ style guide Vertical Whitespace.

QtCreator

As QtCreator supports opening CMake projects out of the box ,it does not require a setup procedure if started from a terminal. Note that this is absolutely crucial, because otherwise the environment will not be set correctly and functionality related to rosbuild or catkin will fail when running cmake.

Note that instead of starting QtCreator from a terminal, you can use the following desktop file and use it in your launcher:

$ cat qtcreator.desktop 
[Desktop Entry]
Exec=bash -i -c qtcreator %F
Icon=qtcreator
Type=Application
Terminal=false
Name=Qt Creator
GenericName=Integrated Development Environment
MimeType=text/x-c++src;text/x-c++hdr;text/x-xsrc;application/x-designer;application/vnd.nokia.qt.qmakeprofile;application/vnd.nokia.xml.qt.resource;
Categories=Qt;Development;IDE;
InitialPreference=9

In Ubuntu 13.04 and later, the third line must read:

Icon=QtProject-qtcreator

This is the standard QtCreator desktop file, except for the Exec line that has been modified with "bash -i -c". More about desktop files and their locations for Ubuntu can be found here. Note also that the same trick can be used with eclipse.

If you are experiencing issues with the qtcreator package shipped by Ubuntu when opening the CMakeLists, then try installing QtCreator from Nokia's installer.

rosbuild

To open a rosbuild ROS package code as a project, use "Open File or Project" and select the CMakeLists.txt of your ROS package. Take care to select the "[package_name]/build" directory as the build directory, which is the ROS default. On the next screen click 'Run Cmake' and then Finish. This may not show all the folders such as launch and include in the project tree. If you want to choose the files manually, goto File->New File or Project->Import Project->Import Existing Project and selected to choose all files/folders included in the project.

catkin_make

To open a catkin code as a project, use "Open File or Project" and select the top level CMakeLists.txt of the catkin workspace (e.g. "src/CMakeLists.txt"). Select the catkin build folder as the build directory and 'Run CMake' (in order to enable debugging add following line into arguments edit box: -DCMAKE_BUILD_TYPE=Debug).

Recently this has started to fail, because the main CMakeLists is a symlink to a non writtable location. The workaround is to make a copy to toplevel.cmake instead of using a symlink. And if you want the project to be named something else than "Project" then add a line at the top with "project(MyProjectName)"

To be able to modify all the files in the workspace add those lines in "src/CMakeLists.txt" :

#Add custom (non compiling) targets so launch scripts and python files show up in QT Creator's project view.
file(GLOB_RECURSE EXTRA_FILES */*)
add_custom_target(${PROJECT_NAME}_OTHER_FILES ALL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES ${EXTRA_FILES})

You may specify the correct catkin devel and install spaces at Projects->Build Settings by providing the following CMake arguments: -DCATKIN_DEVEL_PREFIX=../devel -DCMAKE_INSTALL_PREFIX=../install

catkin tools

With the new catkin_tools, there is no longer a top level make file for the whole workspace. Instead, open each package as an individual project in QtCreator. The trick is to set the build folder to ws/build/your_package instead of ws/build as before.

PyCharm (community edition)

PyCharm is IDE for Python. In order to run and debug ROS functionality you need to modify the desktop file for PyCharm (the same procedure as for other IDE's). Desktop file name was jetbrains-pycharm-ce.desktop. Instead of

Exec="/opt/pycharm-community-4.0.4/bin/pycharm.sh" %f

should be

Exec=bash -i -c "/opt/pycharm-community-4.0.4/bin/pycharm.sh" %f

In the Exec line "bash -i -c" was added.

packages

In order to work with packages just create new project in parent folder for all your packages or in particular package. Please note that folder .idea with project files will be created. You can add it to .gitignore file in case if you are using Git and do not want to commit this file to repository. PyCharm will parse all files in the packages and allow you quick navigation, fast code completions, run and debug Python code, unitest run and debug.

code

run

Code can be run using roslaunch or rosrun command from command line. Simple Python files can be run using run context menu.

debug

In order to debug Python node do the following changes

  • Comment node in the launch file my_nodes.launch
  • If node has any parameters specified inside put them into <group> tag with ns attribute equal to node name

  • Launch my_nodes.launch using roslaunch command
  • Run Python node from PyCharm IDE in debug mode

unittest

run

Unittest can be simple run using content menu on the file in the project tree or on particular method in the code. Results would be shown in UI.

debug

Unittest can be normally debug using start debug menu.

In case of integration test (rostest)

  • Comment <test> tag in the my_file.test launch file

  • launch my_file.test using roslaunch not rostest
  • launch test using PyCharm unittest debug from IDE

Custom Messages/Services

Define and build your messages/services as usual. In order Pycharm to recognize them (for autocompletion, etc.):

  • Open File - Settings

  • Select Project: projectname - Project Structure

  • Select src folder and click on Mark as: Sources

  • Click OK

kDevelop

kDevelop has excellent C++ support, GDB integration and does semantic syntax highlighting with individual colors for different variables. Such as QtCreator, kDevelop supports opening CMake projects out of the box.

kDevelop must know the ROS environment variables, therefore start kDevelop from a terminal that has sourced your catkin workspace already. Alternatively, create the following desktop file according to the remarks in the general section and mark it as exectuable:

cd ~/Desktop
touch kDevelop.desktop
# Now edit the file using the editor of your choice and insert the text from the box below
chmod +x kDevelop.desktop

[Desktop Entry]
Type=Application
Terminal=false
Exec=bash -i -c "kdevelop" 
Name=kDevelop
Icon=kdevelop

Building catkin packages

In order to build your packages in your catkin workspace, you can choose between two different approaches. The particular choice depends on your utilized build system and your personal preference, whether to build the complete catkin workspace at once or to build each package separately with kDevelop.

Import catkin top-level workspace

The following steps describe how to import the complete catkin workspace into kDevelop. This approach relies on the default catkin build system in ROS.

  • It is recommended to clear the catkin build folder before importing the project. You can safely remove the build folder from your catkin workspace since it will be created again during the cmake configure and build process.
  • Start kDevelop from shell or using the modified desktop shortcut mentioned above.
  • Goto the "Project" tab and select "Open / Import Project...". Switch to your catkin source space (we assume ~/catkin_ws/src here) and select "CMakeLists.txt". Afterwards, you may replace the "Name" by your workspace name (default: "src"). Make sure that the selected "Build System" is "CMake Project Manager". Proceed by clicking on "Finish".

  • A new window should appear that contains cmake build configurations.
  • Set the "Build Directory" to the catkin build space, e.g.: /home/user/catkin_ws/build/

  • Select your desired "Build type".
  • Finally, add the following Extra Arguments to make sure, that the binaries and libraries are moved into the correct catkin spaces (devel and install):

    -DCATKIN_DEVEL_PREFIX=../devel -DCMAKE_INSTALL_PREFIX=../install

  • Wait until kdevelop has finished importing your workspace. Try to compile your code by clicking on the "Build button".
  • After switching to the source code of an underlying package let kDevelop some seconds to parse for auto-completion and code highlighting.

Build individual packages with catkin_tools

This approach uses the custom catkin_tools environment for building your packages. Make sure to configure your catkin-tools workspace properly before you proceed with the kDevelop setup.

Perform the steps as mentioned in the section before, but with the following differences:

  • Select the "package/CMakeLists.txt" rather than any top-level "CMakeLists.txt".
  • Set the "Build Directory" to a subfolder in your build space according to the package name, e.g.: /home/user/catkin_ws/build/package

  • Extra Arguments must be adapted to match the proper workspace structure:

    -DCATKIN_DEVEL_PREFIX=../../devel -DCMAKE_INSTALL_PREFIX=../../install

Running and debugging your executables

Configure executable:

  • After the catkin workspace is successfully imported and builded, goto: "Run -> Configure Launches...".

  • Click on the "Add New..." menu and try to find your executable in the "Project Executables" submenu. If the binary is not listed there, you can add it manually using "Add New... -> Compiled Binary" (specify the location of the executable/binary, e.g. "~/catkin_ws/devel/lib/package/node_name").

  • Optionally specify any arguments.
  • Finish configuration by clicking "OK".

Run executable:

  • Just click on "Execute". In case of multiple configured executables, select the current executable at "Run -> Current Launch Configuration".

Debug executable:

  • Add a breakpoint to a related package source file and click on the "Debug" button. Make sure that the current launch configuration is set to the correct binary.

Remarks

If something went wrong, delete the "*.kdev4" file and the ".kdev4" folder inside your source space and try to repeat the procedure.

The "Build Type" selected during project import (e.g. "Debug", "Release", "RelWithDebInfo") can be changed by right-clicking on the project -> "Open Configuration...". Select CMake in the left menu and change the CMake variable "CMAKE_BUILD_TYPE" appropriately.

Note, if a package inside the catkin workspace specifies its own "Build Type", e.g. by adding set(CMAKE_BUILD_TYPE Release) to the underlying package "CMakeLists.txt", it will be used for that package instead of the global one defined in the top-level CMake project.

You may set up a project filter since kDevelop displays a lot of files and (ros) binaries in the source tree that are not really interesting for the developer and finding individual files could be really confusing. Right click on the project and select "Open Configuration...". Choose "Project Filter" in the left menu. The cleanest solution is to first exclude all files and then include only desired file types:

  1. Click Add. Type in the pattern: "*" (just the star character) and select as "Target" only Files. Choose "Action" Exclude.

  2. Now add all files you want include into the project tree:

    Click "Add" and type in your desired file pattern. Choose "Action" Include. Suggested file patterns are: ".h" ".cpp" ".hpp ".c" ".ipp" ".c" ".txt" ".launch" ".xml" ".md" ".cmake" ".cfg" ".py" ".yaml" ".urdf" ".sdf" ".xacro"

Wiki: IDEs (last edited 2016-05-27 09:21:49 by VincentRousseau)