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

roslaunch python

asked 2014-07-14 08:12:22 -0600

Maya gravatar image

Hello,

I'm trying to write a launch file for my python program. My program is named search.py and is located in searching_tobot/src. Here is my launch file so far :

<launch>

<group ns="robot0">
<node name="search" pkg="searching_tobot" type="search" output="screen">
  </node>
</group>

<group ns="robot1">
<node name="search" pkg="searching_tobot" type="search" output="screen">
  </node>
</group>

</launch>

However I have this error :

core service [/rosout] found
ERROR: cannot launch node of type [searching_tobot/search]: can't locate node [search] in package [searching_tobot]
ERROR: cannot launch node of type [searching_tobot/search]: can't locate node [search] in package [searching_tobot]

And I can't find what I'm doing wrong. I tried replacing search by search.py with no luck

I'm used to do launch file with C++ executable and I'm a bit of a newbie with python on ROS and I couldn't find the answer and the wiki :S. Thanks a lot !

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2014-07-14 09:03:26 -0600

Wolf gravatar image

I am not sure if who have to use search or search.py (I believe the latter or both work) but one should work. My guess is your script file is not executable. Go to your searching_tobot/src and run

chmod +x search.py
edit flag offensive delete link more

Comments

2

You need to use whatever the file is called, so probably search.py.

dornhege gravatar image dornhege  ( 2014-07-14 09:39:25 -0600 )edit

i tried this and it works, what is the reason behind this ?

marawy_alsakaf gravatar image marawy_alsakaf  ( 2017-11-02 04:47:05 -0600 )edit
2

answered 2016-01-25 04:30:27 -0600

donmrsir gravatar image

updated 2016-01-25 04:31:52 -0600

Also i don't know if this was your problem. But when you launch a node, the type parameter is the name of the executable to launch. Therefore since python does not need a compiler, and the executable is the own .py file. You need to just specify the .py file. This means something like this.

<node name="search" pkg="searching_tobot" type="search.py" output="screen">

I had a similar problem and this worked for me.

Hope this helps to anyone!

edit flag offensive delete link more

Comments

Isn't this exactly what @Wolf answered (and @dornhege clarified)?

gvdhoorn gravatar image gvdhoorn  ( 2016-01-25 06:07:39 -0600 )edit

Oh yes! sorry, I thought they refer to the sintaxis in the chmod call. Didnt read it carefully, my fault. Thank you for the note

donmrsir gravatar image donmrsir  ( 2016-01-26 02:56:47 -0600 )edit

No problem, don't worry. I was just wondering whether there was something in addition to what the other answer already provided.

gvdhoorn gravatar image gvdhoorn  ( 2016-01-26 03:32:04 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-14 08:12:22 -0600

Seen: 12,714 times

Last updated: Jan 25 '16