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.
我做得还比较顺利。
下面就是运行了:
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
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++)):
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.
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的代码。
遇到无法导入到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 followReusing 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++)):
[0m[ INFO] [1276011369.925053237]: I published [Hello there! This is message [0]][0m [0m[ INFO] [1276011370.125082573]: I published [Hello there! This is message [1]][0m [0m[ INFO] [1276011370.325025148]: I published [Hello there! This is message [2]][0m [0m[ INFO] [1276011370.525034947]: I published [Hello there! This is message [3]][0m
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, choosein 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的代码。
相关文章推荐
- JAVA爬虫WebCollector
- 参数类型对java用继承实现多态时的影响
- java学习笔记(二) InputStream
- Java学习之【深入理解Java虚拟机---Java内存区域】
- JDK的安装和Java环境变量配置
- Java 异常及异常处理
- Java学习笔记之<反射、内省、BeanUtils包操作JavaBean的对比>
- Spring实现AOP的4种方式
- spring jdbc rowmap 使用方法
- spring jdbc 事物的使用心得
- spring jdbc 使用感想
- java学习之旅63常用类_包装类_Integer_Number_JDK源码分析
- JAVA--反射(基础知识~~真的是基础的哦)
- JAVA基础_简析Java中的new,this,super,final关键字
- eclipse设置自动注释的@author的值 ${user}变量
- Java线程池使用说明
- Spring-01-HelloWorld
- java static关键字
- Java初涉之4--浅谈静态块和非静态块
- java中初始化对象变量的方法