Ask Your Question
0

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 my_python.py

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/my_python.py]: can't locate node [my_python] in package [my_package]

No processes to monitor

my launch file like this(my_launch.launch):

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

Comments

2

Try type="my_python.py" instead?

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

Exactly, Thank you.

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

1 Answer

Sort by ยป oldest newest most voted
3

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 my_python.py. Therefore, my_launch.launch should be

<launch>
  <node name="my_python" type="my_python.py" pkg="my_package" />
</launch>

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 http://wiki.ros.org/roslaunch/XML/node

edit flag offensive delete link more

Comments

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

suoxd123 gravatar imagesuoxd123 ( 2018-05-23 03:48:09 -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

2 followers

Stats

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

Seen: 240 times

Last updated: May 23 '18