Configure Eclipse IDE in catkin of Ros Groovy

來源:互聯網
上載者:User
文章目錄
  • 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 @ 2013-05-16 17:03 from [FreedomShe]

由於Groovy之前是rosbuild workspace為主,官方的IDE環境配置以rosbuild為範例來介紹,而目前(2013.5)對預備取代rosbuild的catkin並無提及(refer1 http://www.ros.org/wiki/IDEs)。熟悉Cmake的人已經解決catkin中配置Eclipse for C/C++的問題(refer2 http://answers.ros.org/question/52013/catkin-and-eclipse/),但實驗時出現過無法調試的問題。後來加上CMAKE_BUILD_TYPE=Debug就好了,藉此總結一下配置過程。

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 could 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 to:

cd /usr/share/applications/

Create a launcher with gedit:

sudo gedit eclipse.desktop

Edit the launcher as follows:

[Desktop Entry]Name=eclipseType=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/eclipse” is to source ROS and start your IDE, then your IDE will run with ROS environment.

Save the file, and grant it with:

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_make command will make cmake to generate several Eclipse files in the build/ 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, select File --> Import --> Existing projects into workspace, hit next, then browse for your catkin_ws directory (just select workspace directory). Do NOT select Copy 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, the [Source directory] contains your source code, you may edit the code under this directory later.

You can build your project inside Eclipse with Ctrl+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 should 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: 對於refer2(http://answers.ros.org/question/52013/catkin-and-eclipse/),如果用第二種方法,會在src裡面產生垃圾檔案,破壞了catkin的原始結構;用第一中方法保證了原始結構,但是會遇到調試不成功的問題,我是在產生Eclipse project時候加上CMAKE_BUILD_TYPE=Debug才可以的。英文不好的應該不會研究Ros吧,翻譯得太彆扭,就用我彆扭的E文總結了下……

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.