Create Eclipse project for ROS-package
Set a directory for own ROS-packages as current (in this example “ros-sandbox”).
cd ~/ros-sandbox
How to setup a folder for own ROS-packages
Create a ROS package with first-order dependency to a ROS-package “roscpp”.
roscreate-pkg ExampleCpp1 roscpp
Move to directory of created package.
roscd ExampleCpp1
Create an Eclipse project.
make eclipse-project
It is not needed to prepare a project for Eclipse. Run commands “make” or “rosmake” with a ROS-package name as an argument to build the package (“rosmake” also builds dependent ROS-packages). Errors during building the ROS-package indicate existing problems. E.g. following errors: /home/user1/ros-sandbox/ExampleCpp1/src/talker.cpp:49: undefined reference to `ros::Rate::Rate(double)’ This most likely indicates that dependency on the package “roscpp” was not defined when ROS-package was created by the command “roscreate-pkg” or a following line was removed from the file “manifest.xml” located in the directory of this ROS-package <depend package=”roscpp”/> When to use commands 'make' or 'rosmake'?
/home/user1/ros-sandbox/ExampleCpp1/src/talker.cpp:67: undefined reference to `ros::console::g_initialized’
/home/user1/ros-sandbox/ExampleCpp1/src/talker.cpp:77: undefined reference to `ros::spinOnce()’
Import Eclipse project of ROS-package to Eclipse
Run Eclipse from the Terminal – this allows to use same environment variables as for ROS packages.
. eclipse
. (“dot” or “full stop”) as well as a command “source” – both followed by space – specifies that a command, script or program is needed to be run within same environment as it is in this shell session (in this started Terminal). Command like “./command_name” runs the command with a new shell. What is . ('dot' or 'full stop') in the command?
In the Eclipse select menu items File/Import to open the dialog “Import”.
In the dialog “Import” select “C/C++”/”Existing Code as Makefile Project”, click a button “Next”.
In the dialog “Import Existing Code” click a button “Browse”, find and select the folder with created ROS-package – “Project Name” will be automatically filled in with the package name. Leave check-boxes “Language” ticked for “C” and “C++”. Select an item “Linux GCC” in the list “Toolchain for Indexer Settings”. Click on the button “Finish” to complete import of the project.







