Error:cannot launch node of type[test/test]:cannot locate node test in package test
Hi, i have created a new pkg called test to test out the sound_play pkg . If i could use it to make my own pkg for my project. Thus , i created a simple pkg with just 1 launch file and 1 cpp file with a package and cmake file. The package is able to compile but when i roslaunch it give the eroor of not being able of launch the node type and it is because it cant locate the node. Anyone have any help? Is it because my launch file wrote wrongly?
my launch file:
<launch>
<node name="soundplay_node" pkg="sound_play" type="soundplay_node.py"
<node name="test" pkg="test' type="test"/>
<launch>
I know that my package is called test but for node name , is it declared under the the add executable isn't it? For that i wrote : add_executable (test src/test.cpp)
for the dependencies : add_dependencies (test ${catkin_EXPORTED_TARGETS})
for linktarget libraries `targetlinklibraries (test ${catkinLIBRARIES})`
My error is: ERROR: cannot launch node of type [test/test]: can't locate node [test] in package [test]
Asked by lolz733 on 2016-09-25 20:00:51 UTC
Answers
Try to execute: rospack profile
It is possible that you package has not been added yet to ROS's package list, the above command will explore the packages in your workspace and build the new list.
After that try to launch your test again.
Also, if the launch file that you attached is a "copy&paste" of your actual file, it will not work because there is syntax errors.
Original:
<launch>
<node name="soundplay_node" pkg="sound_play" type="soundplay_node.py"
<node name="test" pkg="test' type="test"/>
<launch>
Correct:
<launch>
<node name="soundplay_node" pkg="sound_play" type="soundplay_node.py"/>
<node name="test" pkg="test" type="test"/>
</launch>
Asked by Martin Peris on 2016-09-25 21:24:21 UTC
Comments
ps it was typo* my original launch file is the correct one >.> but it still says the same error.
Asked by lolz733 on 2016-09-25 23:30:57 UTC
Does catkin_make compile your node without problems?
Asked by Martin Peris on 2016-09-26 00:25:36 UTC
yeah but weird thing is i tried doing it on my friend laptop and it works but its ok >.> its project but thanks anyway
Asked by lolz733 on 2016-09-26 00:56:13 UTC
It's probably a permissions issue: make sure the file has executable permission (in your case soundplay_node.py file).
you can achieve this by entering the folder that contains that file and type: chmod +x file_name
Asked by morann on 2018-09-02 03:46:09 UTC
Comments
had a same issue, this worked for me. make sure you are giving permission to both cpp and launch file.
Asked by parthp08 on 2020-05-11 08:44:40 UTC
C++ source files (.cpp
) and .launch
files are not executable by themselves. They should not need to be given executable permission.
Asked by gvdhoorn on 2020-05-11 08:47:33 UTC
it was giving me an error so i followed @morann 's answer and gave permission and that worked. so not sure what is causing this error if not this. i am beginner so dont have that much experience.
Asked by parthp08 on 2020-05-11 08:51:53 UTC
I would try to figure out what the real cause is, as making .cpp
and .launch
files executable doesn't make much sense.
Asked by gvdhoorn on 2020-05-11 09:26:09 UTC
it gives me this error if .cpp file dont have executable permission.
ERROR: cannot launch node of type [test_pkg/test.cpp]: can't locate node [test.cpp] in package [test_pkg]
not sure about .launch file but shouldn't cpp be executable because we are running that file.
i checked on other sites too for the people having similar problem and mostly all of them solved it with giving executable permission to cpp file.
Asked by parthp08 on 2020-05-11 09:35:48 UTC
but shouldn't cpp be executable because we are running that file.
no. .cpp
are not executables. The binaries which are the result of compiling .cpp
files are executables.
.cpp
are not scripts, like Python.
Your issue is that you're asking roslaunch
to start a .cpp
file, which can't work.
Set the type
to the name of the executable and things will work.
This has nothing to do with making Python files executable.
Asked by gvdhoorn on 2020-05-11 12:16:13 UTC
Comments