您的位置:首页 > 编程语言 > Java开发

ROS进阶学习手记 4 -- 使用Eclipse开发ROS

2015-07-18 22:48 567 查看
http://wiki.ros.org/IDEs

遇到无法导入到eclipse的问题,用下一篇文章的思路进行解决:
http://www.cnblogs.com/freedomshe/archive/2013/05/16/configure_eclipse_in_catkin.html http://blog.csdn.net/sujun3304/article/details/18572017 http://answers.ros.org/question/52013/catkin-and-eclipse/
【步骤】

1. 在catkin 's workspace下建立自己的package: beginner_tutorials

2. Transfor your catkin project into Eclipse project. i.e. create the .project files.

3. import the Eclipse's project into Eclipse.

4. Try to compile, build and debug your code.



中途我遇到一点问题,就是我在exbot上下载安装的Ubuntu12.04 for ROS in Hydro(开发版), 打开Eclipse发现Project Pannel里不显示任何项目。后来重装了一次才解决。

完成了make the Eclipse Project以后,就可以follow the http://wiki.ros.org/IDEs to import >> Build.

我做得还比较顺利。

下面就是运行了:

Running and debugging your executables within Eclipse

As for building within Eclipse, the crucial step here is to set the required environment variables correctly in the launch configuration. As the same for building, this should work out-of-the-box, especially if you follow
Reusing your shell's environment from above.

Create a new launch configuration:

by clicking on Run --> Run configurations... -->
C/C++ Application (double click or click on New). Select the correct binary on the
main tab (Search project should work when your binary was already built). Then in the
environment tab, add (at least)

ROS_ROOT
ROS_MASTER_URI

again with the values of your installation. If you are unsure about them, open a terminal and run

echo $ROS_ROOT
echo $ROS_MASTER_URI


Finally, if you cannot save the configuration, remove the
@
character in the name of the new run configuration.

This should now allow you to run and debug your programs within Eclipse. The output directly goes into the
Console of Eclipse. Note that the ROS_INFO macros use ANSI escape sequences, which are not parsed by Eclipse; therefore, the output might look similar to this one (from

Writing a Publisher/Subscriber (C++)):
[ INFO] [1276011369.925053237]: I published [Hello there! This is message [0]]
[ INFO] [1276011370.125082573]: I published [Hello there! This is message [1]]
[ INFO] [1276011370.325025148]: I published [Hello there! This is message [2]]
[ INFO] [1276011370.525034947]: I published [Hello there! This is message [3]]


You could use an ANSI console plugin (e.g. http://www.mihai-nita.net/eclipse/) to get rid of the "[0m" characters in the output.

More eclipse goodies

Setup a file template that pre-formats whenever a new source or header file is created. The template could for example contain the license header, author name, and include guards (in case of a header file). To setup the templates, choose
in the Preferences C/C++->Code Style->Code Templates. For example, to add the license header choose
Files->C++ Source File->Default C++ source template and click on
Edit.... Paste the license header and click OK. From now on, all source files while automatically contain the license header.

Enable Doxygen with the project properties clicking on
C/C++ General
, enabling project specific settings and selecting Doxygen as
Documentation tool. This option automatically completes Doxygen style comments highlights them.

People that are used to the emacs key bindings can select emacs-style bindings in
Windows->Preferences General->Keys and selecting the emacs Scheme. Also, other useful key bindings (e.g. make project) can easily be added.

To also index files that live outside the ROS tree (e.g. the boost include files) you can add them in project properties
C/C++ General->Paths and Symbols.

The generated eclipse project also works great for Python code. Just install the
PyDev plugin for syntax highlighting and code completion.

Finished.

======= 开始用Eclipse写一个发布给Turtlesim_node驱动和角度Msg的 my_node1 =====

参考Youtube上两个视频:


[CS460] ROS Tutorial 4.1 Turtlesim Cleaner Application - An Overview


[CS460] ROS Tutorial 4.2 Moving in a Straight Line (Turtlesim Cleaner)

我们来在Eclipse里写这个node的代码。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: