8000 Home · syoamakase/Re-ROS Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
syoamakase edited this page May 6, 2017 · 2 revisions

Welcome to the Re-ROS wiki!

We discribe ROS techniques.

import *** in python

0.create python scripts

In this example, create src/dirctory_name/test.py

1.create setup.py in a package

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

# fetch values from package.xml
setup_args = generate_distutils_setup(
    packages=['dirctory_name'],
    package_dir={'': 'src'},
)

setup(**setup_args)

2. uncomment catkin_python_setup() CMakeList.txt

## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
catkin_python_setup()

3.build

Then, you can use python scripts as follows:

import directory_name.test

Clone this wiki locally
0