# A silly question about packages organization!!!

Inside a package there is initially the two files CMakeList.txt and package.xml and the folder src. From the tutorials, I understood that the scripts belonging to a package should be placed in its scr folder. However, while studying ROS I found many packages that had thier scripts placed in a user created folder called scripts. Taking into account the said, my question is: Why someones creates a new folder called script instead to use the already existing one called scr. Is this a ROS good practices or just a user preference? If it is a good practice, for what I should use the folder script and for what should I use the folder src.

edit retag close merge delete

Do you have an example of such a package?

( 2016-02-24 10:28:02 -0600 )edit
( 2016-02-24 12:44:33 -0600 )edit

Sort by » oldest newest most voted

catkin_make looks inside your src directory. However, my understanding is that those scripts are in Python and don't need to go through the gcc compiler. Thus, it doesn't need to compile them into executables. Generally you'd put them in src if they were C++ files. I'm not exactly sure what "good practices" are in this scenario but that's why it's ok to put them in scripts instead of src.

more

In order to complement @alee answer, the best practice (up to my knowledge) is:

• Scripts should go in a scripts folder.
• Python code (classes, etc) which are not scripts should go into src/<pkg_name>/. Then, in your scripts (or python code) which are not necessarily in the same package, you can import using from <pkg_name> import foo.
more

This is mostly relevant for python packages. The usual practice is to put scripts that can be executed by users in the scripts directory and put source files (also .py) that these scripts use in the src directory.

more