Package file hierarchy in kinetic

asked 2017-04-21 16:06:15 -0600

xxsergioxx gravatar image

I've been reading the docs and some answers here, but I can't figure out the preferred way to organize the files of the package I'm writing. This thread is close to what I need, but it has no mention of the nodes directory, and I can't fully understand this other.

Particularly, I'm coding in python. I've read the tutorials and some write nodes as functions and others as classes; calling a function or an instance method in __main__'s body. I'm going for the class approach (I'll post another question about that). So, I have files for class definition, files for utility functions, files for messages (should these go on a different package?), and I understand there should be files for nodes.

I've read about code organization schemes and seen something like:

<package>/
         |--- src/
         |       |--- <package>/
         |       |             |--- classes.py
         |       |             |--- utilities.py
         |       |
         |       |--- nodes/
         |       |         |--- node1_bin
         |       |         |--- node2_bin
         |       |
         |       |--- scripts/
         |                   |--- some_script
         |
         |---/msg/

Is this correct? If not, how should I organize code?

edit retag flag offensive close merge delete

Comments

That looks reasonable. rosrun and roslaunch will look for nodes and launch files in any subdirectory of your package, so there's some flexibility in the directory layout.

ahendrix gravatar image ahendrix  ( 2017-04-22 00:14:59 -0600 )edit