0
$\begingroup$

Rosanswers logo

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 !


Originally posted by Maya on ROS Answers with karma: 1172 on 2014-07-14

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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

Originally posted by Wolf with karma: 7555 on 2014-07-14

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by dornhege on 2014-07-14:
You need to use whatever the file is called, so probably search.py.

Comment by marawy_alsakaf on 2017-11-02:
i tried this and it works, what is the reason behind this ?

$\endgroup$
0
$\begingroup$

Rosanswers logo

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!


Originally posted by donmrsir with karma: 363 on 2016-01-25

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by gvdhoorn on 2016-01-25:
Isn't this exactly what @Wolf answered (and @dornhege clarified)?

Comment by donmrsir on 2016-01-26:
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

Comment by gvdhoorn on 2016-01-26:
No problem, don't worry. I was just wondering whether there was something in addition to what the other answer already provided.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.