关于ROS包的必要性

时间:2015-10-05 16:28:15

标签: python-2.7 ros rospy

到目前为止,在处理我的项目时,我一直在使用rospy建立主题和节点构建ROS脚本,订阅事物,并且通常只执行各种功能。不过,我已经开始相信,最终我的脚本需要被制作成包装,其概念是它们增加了程序的模块性(而且就是事情的完成方式) )。

到目前为止,我的脚本非常紧凑,我不明白为什么发送一个调用rospy的python脚本会需要这种额外的包装级别(特别是考虑到大多数ROS wiki的混淆性)教程)。到目前为止,我还没有为我的任何程序创建catkin包或任何东西。是否有一些压倒性的原因,我需要关注ROS包和catkin之类的东西?现在,我还没有看到一切正常,并且可能会在任何机器上运行脚本。

谢谢!

1 个答案:

答案 0 :(得分:2)

There are a lot of cases in which you definitely want to use catkin:

  • Your package contains C++ code. This has to be compiled which will be taken care of by catkin.
  • You have custom message types. Custom messages have to be generated and compiled. Again this is done by catkin.
  • You have dependencies on other ROS package (or vice versa). catkin resolves this dependencies and build them if necessary.
  • You have Python modules which need to be installed so other packages can use them. Of course you can make your custom setup.py but using catkin is the ROS-way to do this.
  • When your scripts are in a catkin package, you can use the ROS command line tools (rosrun, roscd, rosed, ...), which are very convenient.

As long as you really only have simple Python scripts without dependencies on other non-core ROS packages, you are probably fine without bundling them in a package.
However, as soon as you are sharing your code with other ROS developers, I would package them nonetheless. While it may be working, it will be confusing for the others if they don't get the package structure they are used to.