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

Make nodes executable

asked 2013-04-09 11:56:43 -0600

JaRu gravatar image

Hi.

Must I only make nodes executable which I create by myself (for example like this: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29), or also the nodes which I have downloaded in a package from ROS? Or should the last one are automatically executable?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2013-04-10 04:28:59 -0600

SL Remy gravatar image

To provide another type of answer for the question..

If you're using a compiled language, then the compiler (and the build system) should take care of the all of the details. If using an interpreted language, the a little more work is required.

If the first line of the node is set to the needed Shebang e.g. #!/usr/bin/env python,

and

the file is converted to an executable by changing the file properties e.g. chmod 755 filename (See here and other places on the web for details about chmod),

then the node will be executable.

edit flag offensive delete link more
1

answered 2013-04-09 15:16:37 -0600

updated 2013-04-10 04:02:20 -0600

Those installed from binary repositories should have executables already (except for meta packages). If it is a source package, then you have to compile it first with either rosmake or catkin_make depending on its type. Compiler will set the file mode to executable automatically. For the Python scripts you have to manually set executable flag, otherwise rosrun will not find it.

To run a node (executable) always use rosrun and do not run it manually.

EDIT: as Martin pointed out, using rosrun is not mandatory. However it may help to understand if environment is misconfigured. For instance, rosrun will give an error if package is not on ROS_PACKAGE_PATH in case you forgot to source setup.sh of your workspace etc.

edit flag offensive delete link more

Comments

Why always use rosrun? Running it via rosrun is more convenient, but directly running the node from the command line is just the same.

Martin Günther gravatar image Martin Günther  ( 2013-04-10 01:32:30 -0600 )edit

Probably I formulate it wrongly, but the point is that rosrun help to highlight problems with environment, if tab-completion doesn't work, for example. So for those who just have started to work with ROS it is better to have such a habit.

Boris gravatar image Boris  ( 2013-04-10 03:43:26 -0600 )edit

Okay, seems I misunderstood you. Thanks for clearing it up. :-)

Martin Günther gravatar image Martin Günther  ( 2013-04-10 04:05:09 -0600 )edit

Question Tools

Stats

Asked: 2013-04-09 11:56:43 -0600

Seen: 9,029 times

Last updated: Apr 10 '13