用Eclipse编译你的ROS程序& OpenCV

10 篇文章 0 订阅
6 篇文章 0 订阅

Eclipse构建ROS开发环境

https://blog.csdn.net/jinking01/article/details/80372445

 

 

https://blog.csdn.net/sunbibei/article/details/53643243

Install Java 8

 

1、如果你在 Ubuntu 软件中心安装过 OpenJDK,请先使用如下命令将其删除:

sudo apt-get purge openjdk*

2、添加 PPA 源

sudo add-apt-repository ppa:webupd8team/java

3、更新下源数据库

sudo apt-get update

4安装 Oracle Java 8

sudo apt-get install oracle-java8-installer

5 向你的Eclipse中添加PYTHONPATH环境变量。

Project > Properties > C/C++ Build > Environment

PYTHONPATH

/home/llb/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages

6, Python Interpreter 要添加ros lib 下面的python libraries

 

第5,6两步处理不好的话,用eclipse project build的时候 会出错。

 

 

Install Eclipse

 

2.下载 Eclipse 最新版

访问官方网站下载 Eclipse 最新版,这个就不多说了,大家自己去下。

http://www.eclipse.org/downloads/?osType=linux&release=undefined

unzip it into /home/llb

 

 

1, 用Eclipse编译你的ROS程序 : http://blog.csdn.net/sujun3304/article/details/18572017

 

 

2,eclipse 可以编译project , 但是有时候(因为roscore起来之后会自动source ~/.bashrc文件里的ros环境变量)程序里有错误信息,比如 ros.h找不到之类的。

 http://stackoverflow.com/questions/12836467/configuring-eclipse-for-ros

 

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 eclipsewith 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).

now you can import your project to eclipse

 

after that you can create a desktop application entry for eclispe:

 

sudo gedit /usr/share/applications/eclipse.desktop

[Desktop Entry]

Name=eclipse

Comment=eclipse Client

Exec=bash -i -c "source /opt/ros/indigo/setup.bash && source /home/llb/catkin_ws/devel/setup.bash && /home/llb/eclipse/eclipse"

Icon=/home/llb/eclipse/icon.xpm

Terminal=false

Type=Application

Categories=Application;

Encoding=UTF-8

StartupNotify=true

Drag and Drop eclipse icon from /usr/share/applications/eclipse.desktop to your Dash Bar.

3,所有的问题都可以到这里找答案:  http://wiki.ros.org/IDEs

插件:

  • CMake Editer

 

          地址:http://cmakeed.sourceforge.net/eclipse/

 

  • xxx.launch 文件可以用 xml editor打开。
  • cmake4eclipse

    This Eclipse plugin automatically generates build-scripts for the Eclipse CDT managed build system from CMake scripts.

    • Automatic generation of build scripts. No need to manually invokecmake.
    • Takes your CMakeLists.txt as the source of truth.
    • Supports the ninja build system.
    • Aims to make Eclipse project cross-platform compatible without the need to change platform-specifc project settings.
    • Its Language Settings Provider can feed include paths and pre-processor symbols frrom cmake to the CDT-Indexer.

 

https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_eclipse/linux_eclipse.html

Using OpenCV with Eclipse (plugin CDT)

  • We are only missing one final step: To tell OpenCV where the OpenCV headers and libraries are. For this, do the following:

    • Go to Project–>Properties

    • In C/C++ Build, click on Settings. At the right, choose the Tool Settings Tab. Here we will enter the headers and libraries info:

      1. In GCC C++ Compiler, go to Includes. In Include paths(-l) you should include the path of the folder where opencv was installed. In our example, this is /usr/local/include/opencv.

        Eclipse Tutorial Screenshot 9

        Note

        If you do not know where your opencv files are, open the Terminal and type:

        pkg-config --cflags opencv
        

        For instance, that command gave me this output:

        -I/usr/local/include/opencv -I/usr/local/include
        
      2. Now go to GCC C++ Linker,there you have to fill two spaces:

        First in Library search path (-L) you have to write the path to where the opencv libraries reside, in my case the path is:

        /usr/local/lib
        

        Then in Libraries(-l) add the OpenCV libraries that you may need. Usually just the 3 first on the list below are enough (for simple applications) . In my case, I am putting all of them since I plan to use the whole bunch:

        opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann

        Eclipse Tutorial Screenshot 10

        If you don’t know where your libraries are (or you are just psychotic and want to make sure the path is fine), type in Terminal:

        pkg-config --libs opencv
        

        My output (in case you want to check) was: .. code-block:: bash

        -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

        Now you are done. Click OK

    • Your project should be ready to be built. For this, go to Project->Build all

      In the Console you should get something like

      Eclipse Tutorial Screenshot 12

      If you check in your folder, there should be an executable there.

ROS下如何Debug?5分钟快速入门

http://www.dataguru.cn/article-10359-1.html

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值