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 -0500

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 -0500

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 -0500 )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 -0500 )edit
2

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

donmrsir gravatar image

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

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 -0500 )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 -0500 )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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 12,644 times

Last updated: Jan 25 '16