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

ROS2 building with dependencies

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

MLEV gravatar image

Hello,
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
1

answered 2021-11-16 06:16:06 -0600

rodrigo55 gravatar image

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

Hi,

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 setup.py:

    entry_points={
    '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, https://youtu.be/HV7f3ayQMXw, 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 setup.py as well.

edit flag offensive delete link more

Comments

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

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

Question Tools

1 follower

Stats

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

Seen: 245 times

Last updated: Nov 17 '21