ArticleDirectory
- 1.1. Download Eclipse IDE for C/C ++
- 1.2. install Java 7 if you have not
- 1.3. Create a launcher to run eclipse from your Ros-sourced Shell
Posted @From [freedomshe]
Because groovy was previously dominated by rosbuild workspace, the official IDE environment configuration is described in the rosbuild sample, and currently (2013.5) does not mention the catkin to replace rosbuild (refer1 http://www.ros.org/wiki/IDEs ). People familiar with cmake have solved the problem of configuring eclipse for C/C ++ in Catkin (refer2 http://answers.ros.org/question/52013/catkin-and-eclipse/), but there was a problem that could not be debugged during the test. After that, add cmake_build_type = debug to summarize the configuration process.
Enviorment: Ubuntu 12.04 + Ros groovy + Catkin workspace.
1. Installing eclipse1.1. download Eclipse IDE for C/C ++
Do not use "sudo apt-Get install Eclipse" to install eclipse. instead, go to www.eclipse.org to download the Eclipse IDE for C/C ++ (http://www.eclipse.org/downloads ). and then extract to your folder of your choice.
1.2. install Java 7 if you have not
If you have not installed java7, You Need To Setup java7 before eclipse cocould be run successfully. To install java7 in Ubuntu 12.04, follow as (refer3 http://www.ubuntugeek.com/how-to-install-oracle-java-7-in-ubuntu-12-04.html ):
Sudo add-Apt-repository PPA: webupd8team/javasudo apt-Get updatesudo apt-Get install oracle-java7-installer
If something wrong happens, you may execute these commands before:
Sudo apt-Get purge openjdk * sudo RM/var/lib/dpkg/INFO/oracle-java7-installer * sudo apt-Get purge oracle-java7-installer * sudo RM/etc/APT/sources. list. d/* Java * sudo apt-Get update
More details to refer the refer3 page above.
1.3. Create a launcher to run eclipse from your Ros-sourced Shell
Open a terminal, and then go:
CD/usr/share/applications/
Create a launcher with gedit:
Sudo gedit eclipse. Desktop
Edit the launcher as follows:
[Desktop entry] Name = maid = applicationexec = bash-I-c/opt/Eclipse/eclipseicon =/opt/Eclipse/icon. xpmterminal = false
Note: Do replace"/Opt/Eclipse /"With your eclipse path."Bash-I-c/opt/Eclipse"Is to source Ros and start your ide, then your ide will run with Ros environment.
Save the file, and grant it:
Sudo chmod 777 eclipse. Desktop
Open the dash (Alt + F2), And search "Eclipse" from it, you can see your eclipse now:
Now, I guess you can launch the eclipse successfully!
2. Creating Eclipse project files
Go to your Catkin workspace directory and run catkin_make with options to generate Eclipse project files:
Cd ~ /Catkin_wscatkin_make -- force-cmake-G"Eclipse cdt4-Unix makefiles"-Dcmake_build_type = debug-dcmake_eclipse_make_arguments =-J8.
Catkin_makeCommand will make cmake to generate several eclipse files inBuild/Folder, with these files you can import the catkin project into Eclipse IDE.
3. importing the project into eclipse
Start eclipse from your eclipse launcher, selectFile-->Import-->Existing projects into Workspace, Hit next, then browse for yourCatkin_wsDirectory (Just select workspace directory). Do not selectCopy projects into Workspace. Then finish.
If you haven't created any package, you may follow writing a publisher/subscriber (C ++) to create a package with source files before we test our environment.
Your project construction may be looked like this,[Source Directory]Contains your source code, you may edit the code under this directory later.
You can build your project inside eclipseCTRL + B.
4. Running and debugging your executables within eclipse
Open"Debug configurations"In eclipse. Create a new"C/C ++ Application".
Click"Browse"From the"Main"Tab to select your executable file. The file shoshould be generated after you build your project (CTRL + B), In ~ /Catkin_ws/devel/lib/$ yourpakage/(your path must not as same as mine as showing in the picture .)
You can debug your executable file in eclipse for Ros Catkin workspace now!
Note: For refer2 (http://answers.ros.org/question/52013/catkin-and-eclipse/), if you use the second method, it will generate a junk file in SRC, destroying the original structure of Catkin; with the first method to ensure the original structure, however, debugging fails. I can add cmake_build_type = debug when generating the Eclipse project. I should not study Ros if the English language is not good. If it is too difficult to translate, I will summarize it with my awkward e-paper ......