Ask Your Question

[Theorical] Python use in ROS

asked 2019-09-24 06:54:19 -0600

drodgu gravatar image

Hi everyone,

I'm new using python in ROS but I've been developing robots solution for a little time in C++. The thing is that when you want to use a ROS C++ node you must configure CMakeLists.txt properly in order to built those nodes. The point is that, for what I've seen on ROS Tutorials, when you want to use a python node you does not have to make any configuration of this file: just compile and run on the command console chmod +x in order to make it an executable.

1) Is there a way to make python executable nodes automatically? Something similar to what you do when you configure CMakeLists.txt for a new C++ node.

2) On the other hand, I would like to know if it is compulsory to generate and when you must use it. Because when I use chmod +x *.py sentence I do not write any or file.

3) Finally, is it possible to call from ROS a python module that has been already compiled (for example a non ROS library to make a visual enviroment for an application)? If so, how?

Maybe, there are tutorial on the web that explains all that things but I haven't found any that make it clear to me. Thanks in advance for you help.

edit retag flag offensive close merge delete



Just some high-level clarification: there is nothing really 'special' about using Python in ROS nodes. Just about everything you'd normally be able or would want to do with Python is possible.

Your questions 2 and 3 are essentially not ROS-related questions, but generic Python questions. I'm not writing this because we don't want to help you, but because you don't need to limit yourself "to ROS" related sites when looking for support.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-24 09:08:26 -0600 )edit

Thank you @gvdhoorn, I know that it is not the best option to limit myself just to ROS related sites. But for me it is easier to ask here and make concept relation between all the answer and ROS. And I use this way to ask about this kind of doubts because it could be usefull for another beginner ROS user, I guess that everyone has pretty much the same doubts when they begin using ROS :)

drodgu gravatar image drodgu  ( 2019-09-24 09:47:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-24 08:42:18 -0600

LeoE gravatar image

updated 2019-09-24 13:49:24 -0600

jayess gravatar image


  1. yes, you can actually use the CMakeLists.txt for automatic node creation.
  2. If you want to have an automatic generation as described in 1. you will have to create an and a file. (For 1. and 2. look at this)
  3. Yes, you can, have a look at this or this.
edit flag offensive delete link more


Thanks that was very usefull!

drodgu gravatar image drodgu  ( 2019-09-24 09:44:37 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-09-24 06:54:19 -0600

Seen: 216 times

Last updated: Sep 24 '19