ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to use python files in src/package_name in nodes folder?

asked 2014-02-06 09:04:29 -0500

Vladimir gravatar image

I am writing a catkin project in python. I would like to put nodes in the "node" directory, and other source files in the src/package_name directory. However when I did that and tried to import a python module in the node file (located in the node folder) from the source directory I got an error saying the module didn't exist.

I couldn't find any tutorials on how to do this. Do I have to somehow tell catkin to export my src folder?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2014-02-06 09:10:08 -0500

updated 2014-02-06 09:12:48 -0500

You have to create setup.py, and then add the catkin_python_setup() function to your CMakeLists.txt. A good example package to follow is nmea_navsat_driver.

edit flag offensive delete link more

Comments

2
Dirk Thomas gravatar image Dirk Thomas  ( 2014-02-06 09:36:35 -0500 )edit

Exactly what I was looking for. Thanks!

Vladimir gravatar image Vladimir  ( 2014-02-06 09:46:28 -0500 )edit
1

Dirk— askbot mangles links which are the end of comments. You can add trailing punctuation to fix it, eg: http://docs.ros.org/api/catkin/html/howto/installing_python.html .

mikepurvis gravatar image mikepurvis  ( 2014-02-07 08:10:10 -0500 )edit

Question Tools

Stats

Asked: 2014-02-06 09:04:29 -0500

Seen: 1,009 times

Last updated: Feb 06 '14