Search code examples
python-2.7rosrospy

Regarding the Necessity of ROS Packages


Up until this point, while working on my project, I've been building ROS scripts using rospy- establishing topics and nodes, subscribing to things, and just generally doing all sorts of functions. I've been led to believe, though, that eventually my scripts will need to be made into 'packages', with the notion being that they increase modularity of programs (and is just the way things are done).

So far, my scripts are pretty compact, and I don't see why sending out a python script invoking rospy would require this extra level of wrapping (particularly given the obfuscatory nature of most of ROS wiki's tutorials). I've not had to create catkin packages or anything for any of my programs so far. Is there some overwhelming reason why I need concern myself with ROS packages and catkin and the like? Right now, I just don't see the point when everything works well and likely would across any machine the script is run from.

Thanks!


Solution

  • 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.