Ask Your Question
0

Error:cannot launch node of type[test/test]:cannot locate node test in package test

asked 2016-09-25 20:00:51 -0500

lolz733 gravatar image

updated 2016-09-25 21:19:49 -0500

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 link_target libraries target_link_libraries (test ${catkin_LIBRARIES})

My error is: ERROR: cannot launch node of type [test/test]: can't locate node [test] in package [test]

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-09-02 03:46:09 -0500

morann gravatar image

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

edit flag offensive delete link more

Comments

had a same issue, this worked for me. make sure you are giving permission to both cpp and launch file.

parthp08 gravatar image parthp08  ( 2020-05-11 08:44:40 -0500 )edit

C++ source files (.cpp) and .launch files are not executable by themselves. They should not need to be given executable permission.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-11 08:47:33 -0500 )edit

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.

parthp08 gravatar image parthp08  ( 2020-05-11 08:51:53 -0500 )edit

I would try to figure out what the real cause is, as making .cpp and .launch files executable doesn't make much sense.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-11 09:26:09 -0500 )edit

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.

parthp08 gravatar image parthp08  ( 2020-05-11 09:35:48 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-11 12:16:13 -0500 )edit
0

answered 2016-09-25 21:24:21 -0500

updated 2016-09-25 21:28:59 -0500

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>
edit flag offensive delete link more

Comments

ps it was typo* my original launch file is the correct one >.> but it still says the same error.

lolz733 gravatar image lolz733  ( 2016-09-25 23:30:57 -0500 )edit

Does catkin_make compile your node without problems?

Martin Peris gravatar image Martin Peris  ( 2016-09-26 00:25:36 -0500 )edit

yeah but weird thing is i tried doing it on my friend laptop and it works but its ok >.> its project but thanks anyway

lolz733 gravatar image lolz733  ( 2016-09-26 00:56:13 -0500 )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

1 follower

Stats

Asked: 2016-09-25 20:00:51 -0500

Seen: 2,027 times

Last updated: Sep 02 '18