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

How to use Eclipse IDE for developing Ros2 packages?

asked 2019-06-19 06:28:49 -0600

In the past with ROS1, a simple command like catkin build MY_ROS1_PACKAGE_NAME --force-cmake -G"Eclipse CDT4 - Unix Makefiles" would generate the necessary CMake project settings, so it could be imported in Eclipse via the Import > Existing Projectway. Does anyone know how to do this for ROS2 packages built with colcon? It seems that the idea of building individual packages from the workspace has changed and now we required to build the entire workspace.

Even after following the instructions in https://index.ros.org/doc/ros2/Tutori.... I am not able to Execute/Debug a node within Eclipse.

I'm new to ROS2, but I've been using ROS1 for quite a while. I'm probably missing some conceptual understanding of how colcon works, but it won't hurt to ask if there are any developers using ROS2 in Eclipse that can provide some insight.

edit retag flag offensive close merge delete

Comments

we use qtcreator but i think eclipse will be similar (you'll need to look at cmake4eclipse in the eclipse market, and do read the help without reading the help you won't get there) : first open a terminal and then source the setup.sh from your ROS2 installation and from your ROS2 workspace. then launch qtcreator (and probably eclipse) from that terminal. after that, you'll be able to treat ros2 packages as ordinary cmake projects. for qtcreator enable the (disabled by default) clang plugins to get useful code insight.

Frank Dekervel gravatar image Frank Dekervel  ( 2019-06-21 04:09:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-06-21 07:46:20 -0600

I think I figured it out after looking at the arguments/options differences between catkin_tools and colcon.

Here is an example of what I did usingros2_example_ws, which is assumed to have been already cloned and built previously with just colcon build as specified in the Using Colcon to build packages Tutorial. My additional steps were:

From a terminal:

~/ros2_example_ws$ . install/setup.bash
~/ros2_example_ws$ colcon build --cmake-force-configure --cmake-args -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug

Then, from another terminal:

  • Source the workspace again (e.g. ~/ros2_example_ws$ . install/setup.bash)

  • launch eclipse (I haven't tried launching Eclipse outside of the terminal yet)

  • In Eclipse, do the Import > Existing Project and navigate to the project of interest (e.g. ~/ros2_example_ws/build/examples_rclcpp_minimal_subscriber/), and import this.

  • The executable will show in the Project's Binaries view, so the "node" can be run from there or modified within the Run/Debug Configurations as needed.

NOTE: The -DCMAKE_BUILD_TYPE=Debug in the --cmake-args is only needed if building with Debug flags is desired.

edit flag offensive delete link more

Comments

Once the eclipse project files are generated by your suggestion with colcon, what type of project do I need to start with in eclipse? Is it a generic c/c++ project, a makefile project, a cmake project, or what else?

woodz gravatar image woodz  ( 2021-01-18 17:40:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-06-19 06:28:49 -0600

Seen: 1,245 times

Last updated: Jun 21 '19