Best practices for setting up catkin_make install for python nodes
I am currently updating my code from rosbuild to catkin as I switch from Fuerte to Groovy.
Current setup: Ubuntu 12.04, Groovy
I am looking for best practices for packages with python nodes and libraries.
This is my current file structure:
/groovy-workspace
/build
/devel
/install
/src
/my_meta_pkg
/my_pkg_A
/my_pkg B
/my_pkg_etc...
Under /my_pkg_A:
/scripts
my_node.py
my_API.py (my_node imports my_API)
__init__.py
setup.py
__init__.py
package.xml
CMakeLists.txt
setup.py:
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['my_pkg_A'],
package_dir={'': 'src'}
)
setup(**d)
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(my_pkg_A)
# Load catkin and all dependencies required for this package
set(CATKIN_DEPS std_msgs geometry_msgs rospy)
set(SYS_DEPS python-serial python-sys)
find_package(catkin REQUIRED COMPONENTS ${CATKIN_DEPS})
# Install python scripts using distutils
catkin_python_setup()
catkin_package(
DEPENDS ${SYS_DEPS}
CATKIN_DEPENDS ${CATKIN_DEPS}
)
install(PROGRAMS scripts/my_node.py scripts/my_API.py
DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
)
When I run
catkin_make install
in /groovy-workspace, it fails during the make sequence with the error
error: package directory 'src/my_pkg_A' does not exist
I have deduced that it is looking for the python scripts in the python workspace
/groovy-workspace/src/my_meta_pkg/my_pkg_A/src/my_pkg_A
Would it be best practice to create this directory and move my_node.py, my_API.py, and __init__.py to this directory? Or should I change setup.py to look at /scripts and what would be the best way to do this? Or is there a different way everything should be structured to follow ROS best practices?
Thanks for the help!