Ask Your Question
9

can't locate node in package

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

Mago Nick gravatar image

updated 2014-03-28 06:26:14 -0500

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 imagexinwf ( 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 imageantoineniotna ( 2019-05-13 08:49:09 -0500 )edit

7 Answers

Sort by ยป oldest newest most voted
12

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 imagegraouve ( 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 imageRohitM ( 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 imageMago Nick ( 2016-05-31 04:38:20 -0500 )edit
20

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 imageRick 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 imagechingchi ( 2017-04-05 23:48:14 -0500 )edit

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

transhumanism gravatar imagetranshumanism ( 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 imageAlexG ( 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 imagegvdhoorn ( 2018-09-27 10:36:42 -0500 )edit
3

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 imagexinwf ( 2018-07-18 21:46:08 -0500 )edit
1

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 imageRedhwan ( 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 imagenunuwin ( 2019-07-03 11:42:23 -0500 )edit

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

Qusai gravatar imageQusai ( 2019-07-21 04:06:25 -0500 )edit
0

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

andrei gravatar image

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 imageAbdu ( 2018-02-04 12:48:41 -0500 )edit
0

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 36,283 times

Last updated: Aug 13