0
$\begingroup$

Rosanswers logo

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

Originally posted by Mago Nick on ROS Answers with karma: 385 on 2014-03-28

Post score: 10


Original comments

Comment by xinwf on 2018-07-18:
This doesn't work any more. I use the ros version kinetic, farid's method is useful for me.

Comment by antoineniotna on 2019-05-13:
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">
$\endgroup$

5 Answers 5

0
$\begingroup$

Rosanswers logo

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

catkin_package()

to the CMakeLists.txt file


Originally posted by Mago Nick with karma: 385 on 2014-03-28

This answer was ACCEPTED on the original site

Post score: 15


Original comments

Comment by graouve on 2014-09-18:
This solved my problem too. Thanks for the find.

Comment by RohitM on 2016-05-30:
But your CMakeLists.txt file above already contains a catkin_package statement. Did simply adding that line solve your problem?

Comment by Mago Nick on 2016-05-31:
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)

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by crunchex with karma: 376 on 2016-04-27

This answer was NOT ACCEPTED on the original site

Post score: 30


Original comments

Comment by Rick Armstrong on 2016-10-13:
This answer solves it for me. This one gets me every time, and somehow I forget later on down the road.

Comment by chingchi on 2017-04-05:
Thanks for this info. This is why i cannot locate node in package.

Comment by transhumanism on 2018-04-12:
yeah, I got the same problem. Thanks for your answer!

Comment by AlexG on 2018-09-27:
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.

Comment by gvdhoorn on 2018-09-27:
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.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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

Originally posted by Farid with karma: 165 on 2018-05-29

This answer was NOT ACCEPTED on the original site

Post score: 6


Original comments

Comment by xinwf on 2018-07-18:
This works for me, my ros version is kinetic.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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--

Originally posted by greatonion with karma: 41 on 2018-09-07

This answer was NOT ACCEPTED on the original site

Post score: 4


Original comments

Comment by Redhwan on 2019-04-18:
thanks, this worked for me

Comment by nunuwin on 2019-07-03:
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?

Comment by Qusai on 2019-07-21:
thanks very much, the same problem with python file, it solved now.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by parzival with karma: 463 on 2019-08-13

This answer was NOT ACCEPTED on the original site

Post score: 3


Original comments

Comment by AlessandroSaviolo on 2020-03-19:
Thanks! Solved my issue

Comment by parzival on 2020-03-19:
Glad it helped :)

$\endgroup$

Your Answer

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