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

how do I run my own node by launch file?

asked 2018-05-23 01:04:10 -0600

suoxd123 gravatar image

updated 2018-05-23 02:08:54 -0600

jayess gravatar image

I created one python file in my own pakage. when I execute the following code in command window, it works well.

rosrun my_package

but when I add it in launch file and run it by following code, but it cannot work, just output one ERROR like:

roslaunch my_package my_launch.launch

ERROR cannot launch node of type [my_package/]: can't locate node [my_python] in package [my_package]

No processes to monitor

my launch file like this(my_launch.launch):

  <node name="my_python" type="my_python" pkg="my_package" />
edit retag flag offensive close merge delete



Try type="" instead?

ahendrix gravatar image ahendrix  ( 2018-05-23 01:51:06 -0600 )edit

Exactly, Thank you.

suoxd123 gravatar image suoxd123  ( 2018-05-23 03:44:57 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-23 02:14:01 -0600

jayess gravatar image

@ahendrix is correct. You need to have the type attribute for the node tag be the name of the executable, which in your case, is Therefore, my_launch.launch should be

  <node name="my_python" type="" pkg="my_package" />

If you don't want to have the .py, then just remove it from the filename so that it'll be my_python.

For more information, please see

edit flag offensive delete link more


Yes, Thank you for your explain. I am a freshman for ros programming, still not familar with its grammar.

suoxd123 gravatar image suoxd123  ( 2018-05-23 03:48:09 -0600 )edit

Question Tools



Asked: 2018-05-23 00:53:50 -0600

Seen: 2,635 times

Last updated: May 23 '18