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

ROS2 building with dependencies

asked 2021-11-14 09:52:36 -0500

MLEV gravatar image

I'm new in ROS2 and I lost myself in the dependencies tree. I have a big project I would like to translate to ROS2. When I create the my_package my_node it creates a standart structure. How can I add there all python files I need? There's no chance I can run the whole project using only one python file. Is there some examples I can learn from? Thank all of you in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-11-16 06:16:06 -0500

rodrigo55 gravatar image

updated 2021-11-17 02:49:10 -0500


You can have as many packages, and as many python files you want. All you need to do is structure your workspace correctly.

After creating a package, you can create .py files inside of your_workspace/src/my_package/my_package.

Don't forget to make the files executable with chmod +x, and to include them as an entry point in your

    'console_scripts': [
        ' [executable_name] = [package_name].[executable]:main',

You can add as many python files as you want this way. I'll be uploading a video tomorrow showing this process in our channel,, so check it out if you get stuck from what I explained above, and also if you want to see how to add launch files to your as well.

edit flag offensive delete link more


also for a dependencies tree, don't forget to use colcon

colcon graph
TomSon gravatar image TomSon  ( 2021-11-16 07:43:26 -0500 )edit

Question Tools

1 follower


Asked: 2021-11-14 09:52:36 -0500

Seen: 168 times

Last updated: Nov 17 '21