ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As discussed here, the following is needed:
<ws>/src/<pkg-name>/src/<pkg-name>
<ws>/src/<pkg-name>/src/<pkg-name>/__init__.py
Create <ws>/src/<pkg-name>/setup.py
with
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup()
setup_args['packages'] = ['<pkg-name>']
setup_args['package_dir'] = {'': 'src'}
setup(**setup_args)
catkin_python_setup()
to <ws>/src/<pkg-name>/CMakeLists.txt
catkin_make
<ws>
in VS Code with ROS and Pylint extensions installedsrc/<pkg-name>/src
to "python.autoComplete.extraPaths"
in <ws>/.vscode/settings.json
2 | No.2 Revision |
As discussed here, the following is needed:
<ws>/src/<pkg-name>/src/<pkg-name>
<ws>/src/<pkg-name>/src/<pkg-name>/__init__.py
Create <ws>/src/<pkg-name>/setup.py
with
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup()
setup_args['packages'] = ['<pkg-name>']
setup_args['package_dir'] = {'': 'src'}
setup(**setup_args)
catkin_python_setup()
to <ws>/src/<pkg-name>/CMakeLists.txt
catkin_make
<ws>
in VS Code with ROS and Pylint extensions installedsrc/<pkg-name>/src
to "python.autoComplete.extraPaths"
in <ws>/.vscode/settings.json
You can then from <pkg-name>.<module-name> import <your-content>
from any node script (e.g. <ws>/src/<pkg-name>/scripts/mynode
)