Ask Your Question

catkin rospy package structure

asked 2017-03-09 11:31:03 -0600

gpldecha gravatar image

Hi have been writing a ros python package with the following structure (I checked my structure against moveit_commander).

    |_  src
         |_ python_package
                     |_ bin
                     |   |_ python_package
                     |_ CMakeLists.txt
                     |_ package.xml

When package_python is in the folder src I am able to roscd and roslaunch this package.

However I would like to have package_name inside a root dummy folder python-package. When I do this I am no longer able to roscd, roslaunch, python_package.

    |_  src
         |_ python-package
                    |_ python_package

What should I do in order to have my python_package inside python-package and still be to call use it. For a C++ project this is not a problem.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-09 13:55:20 -0600

imcmahon gravatar image

You need to specify where your python module is in the . Using the moveit_commander example:

from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup()
d['packages'] = ['moveit_commander']
d['package_dir'] = {'': 'src'}


Because of this, the src directory is the where catkin will expect to find the python module.

Shameless plug, I can offer up a repo I maintain answer to your larger question about package structure a few folder layers deep, intera_interface :

Generally speaking, the folder structure for a package containing both python modules and python scripts is as follows:

|_  src
     |_ python_package
                 |_ scripts
                 |    |_python_executable_script_1
                 |    |_python_executable_script_2
                 |   |_python_public_module
                 |   |_python_private_module_1
                 |   |_python_private_module_2
                 |_ CMakeLists.txt   # <-- invoke catkin_python_setup() in here
                 |_ package.xml
                 |          # <--specify public module & directory in here
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-03-09 11:31:03 -0600

Seen: 1,725 times

Last updated: Mar 09 '17