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

can't locate node in package

asked 2014-03-28 05:36:02 -0500

Mago Nick gravatar image

updated 2022-03-20 10:15:05 -0500

lucasw gravatar image

HI everybody, I am having problems in building a large project. I'am trying to add some modularity to my .launch file. I built my launch file as follows

<launch>
 <include file="$(find gazebo_ros)/launch/empty_world.launch">
   <arg name="world_name" value="$(find vtol_gazebo)/worlds/vtol.world"/>
  </include>


    <include file="$(find heterogeneous)/config/heterogeneous.xml"/>

</launch>

with the file included being

<launch>

  <node pkg="heterogeneous" name="het" type="heterogeneous">  
  </node>

</launch>

the node in the heterogeneous package is (successfully) built with the following CMakeLists.txt file

cmake_minimum_required(VERSION 2.8.3)
project(heterogeneous)

find_package(catkin REQUIRED COMPONENTS
  roscpp
)

set(ARMADILLO_INCLUDE /usr/local/include/)
set(ARMADILLO_LIBRARIES /usr/lib/libarmadillo.so)

include_directories(include/${PROJECT_NAME} ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} )

add_executable(heterogeneous src/Heterogeneous.cpp)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} )

catkin_package(
  DEPENDS
    roscpp
)

The file si successfully compiled and the executable added to the project workspace. In fact, if I prompt from the catkin workspace

find -executable -name heterogeneous -type f

I obtain

./build/heterogeneous/heterogeneous

However when I launch the .launch file I get

ERROR: cannot launch node of type [heterogeneous/heterogeneous]: can't locate node [heterogeneous] in package [heterogeneous]

I really cannot figure out what the problem is. I am using ros hydro Any ideas? Thanks Andrea

EDIT: actually I cannot run the node with

rosrun heterogeneous heterogeneous
edit retag flag offensive close merge delete

Comments

This doesn't work any more. I use the ros version kinetic, farid's method is useful for me.

xinwf gravatar image xinwf  ( 2018-07-18 21:43:56 -0500 )edit

I just had the same problem, but for me the problem was in the launch file. I created my node with catkin command, and then personalized the cmake and the launch file, but I did a mistake by switching name_node to name. I know it is a very specific mistake but maybe it will help the next guy!

True:

<node name="$(arg node_name)" pkg="hil" type="hil_node" clear_params="true" output="screen">

False:

<node name="$(arg node_name)" pkg="hil" type="hil" clear_params="true" output="screen">
antoineniotna gravatar image antoineniotna  ( 2019-05-13 08:49:09 -0500 )edit

8 Answers

Sort by ยป oldest newest most voted
15

answered 2014-03-28 06:35:04 -0500

Mago Nick gravatar image

I have found the problem, I had to add the line

catkin_package()

to the CMakeLists.txt file

edit flag offensive delete link more

Comments

This solved my problem too. Thanks for the find.

graouve gravatar image graouve  ( 2014-09-18 06:50:18 -0500 )edit

But your CMakeLists.txt file above already contains a catkin_package statement. Did simply adding that line solve your problem?

RohitM gravatar image RohitM  ( 2016-05-30 20:28:43 -0500 )edit

It's a two years old post, so I cannot be 100% sure. But yes, that solved the issue. Now that I know more about that I can tell you that the error is I put the catkin_package statement at the end. After declaring the executable. It has to be done before the find package statements (imho)

Mago Nick gravatar image Mago Nick  ( 2016-05-31 04:38:20 -0500 )edit
30

answered 2016-04-27 13:44:51 -0500

crunchex gravatar image

For python nodes, check the permissions on the script. If it's not marked as executable, then you will get this same cryptic error message.

edit flag offensive delete link more

Comments

1

This answer solves it for me. This one gets me every time, and somehow I forget later on down the road.

Rick Armstrong gravatar image Rick Armstrong  ( 2016-10-13 03:06:01 -0500 )edit
1

Thanks for this info. This is why i cannot locate node in package.

chingchi gravatar image chingchi  ( 2017-04-05 23:48:14 -0500 )edit

yeah, I got the same problem. Thanks for your answer!

transhumanism gravatar image transhumanism  ( 2018-04-12 21:23:37 -0500 )edit
2

2 years later and also ran into this issue... They really could setup an additional check for permissions before throwing an error about not finding the file.

AlexG gravatar image AlexG  ( 2018-09-27 09:55:02 -0500 )edit
1

ROS is an open-source project. It depends on people like you to find issues and solve them. If all we do is complain nothing will change. You have the power to fix this for all future users, including yourself.

gvdhoorn gravatar image gvdhoorn  ( 2018-09-27 10:36:42 -0500 )edit
6

answered 2018-05-29 06:21:35 -0500

Farid gravatar image

For those fellows who are still getting the same error:

Go to your catkin workspace:

$ cd ~/catkin_ws/

and bash file needs to be added to devel folder:

$ source devel/setup.bash
edit flag offensive delete link more

Comments

This works for me, my ros version is kinetic.

xinwf gravatar image xinwf  ( 2018-07-18 21:46:08 -0500 )edit
4

answered 2018-09-07 09:03:15 -0500

greatonion gravatar image

I had the same issue in my case it was no execution permision for python file. To make file executable please go your package/src directory and type

chmod +x your_file.py

You may want to check first if files have execution permision by cmd

ls -la

If file is executable it should have x permision in list like:

rwxrwxrwx

If file is not executable ls -la will display it without x:

rx-rw-r--
edit flag offensive delete link more

Comments

thanks, this worked for me

Redhwan gravatar image Redhwan  ( 2019-04-18 03:20:21 -0500 )edit

I've the same error and I checked according to your advise for executing permission. In there I have no permission sign. How can I do to get permission?

nunuwin gravatar image nunuwin  ( 2019-07-03 11:42:23 -0500 )edit

thanks very much, the same problem with python file, it solved now.

Qusai gravatar image Qusai  ( 2019-07-21 04:06:25 -0500 )edit
3

answered 2019-08-13 07:33:26 -0500

parzival gravatar image

For python nodes, writing it as type="file.py" instead of just type="file" works for me.

edit flag offensive delete link more

Comments

Thanks! Solved my issue

AlessandroSaviolo gravatar image AlessandroSaviolo  ( 2020-03-19 07:32:49 -0500 )edit
1

Glad it helped :)

parzival gravatar image parzival  ( 2020-03-19 08:17:49 -0500 )edit
0

answered 2020-06-16 15:09:44 -0500

Haresh Miriyala gravatar image

updated 2020-06-16 15:09:56 -0500

Had the same issue. I solved it by renaming the python script containing the node the same as the node.

edit flag offensive delete link more
0

answered 2019-08-19 01:46:01 -0500

anonymous user

Anonymous

Executable was not built or has another name - is the usual reason for this error.

It is not actually an answer to the question, because executable was checked by the question creator. But if someone else find it, please check the obvious reason first. : )

edit flag offensive delete link more
0

answered 2015-10-08 02:13:56 -0500

homalm gravatar image

I have created two ROS nodes and have compiled them using add_executable command in the "CMakeLists.txt". I have also added them to the launch file that I am running using roslaunch. But when running roslaunch, I get the same ERROR: cannot launch node of type [r/r2_detect]: can't locate node [r2_detect] in package [r]

I tried adding catkin_package() to the "CMakeLists.txt" as suggested here: http://answers.ros.org/question/14580... , but it did not work. Where should I add catkin_package() ?

edit flag offensive delete link more

Comments

what did you do guys to solve your issue ?

Abdu gravatar image Abdu  ( 2018-02-04 12:48:41 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2014-03-28 05:36:02 -0500

Seen: 65,649 times

Last updated: Jun 16 '20