ERROR: cannot launch node - can't locate node

asked 2018-11-29 17:11:38 -0500

Naukhel gravatar image

Hi! I'm trying to run a launcher to spawn turtles and to make them move. I have two files in the src directory: kill_turtle2.cpp and explore.cpp. I also have a message named RobotPose.msg. Here is the launcher code:

    <param name="nTurtle" value="3" />
    <node pkg="turtlesim" type="turtlesim_node" name="simulator" />
    <node pkg="esercizio_4" type="exploration" args="myturtle1 3 3 1"  name="turtlenode" launch-prefix="xterm -bg Teal -geometry 120x31+10+10 -e "/>
    <node pkg="esercizio_4" type="kill_turtle2" name="mykiller" />
    <node pkg="esercizio_4" type="exploration" args="myturtle2 9 8 1" name="turtlenode2" launch-prefix="xterm -bg Teal -geometry 120x31+210+110 -e "/>
    <node pkg="esercizio_4" type="exploration" args="myturtle3 4 5 1" name="turtlenode3" launch-prefix="xterm -bg Teal -geometry 120x31+410+210 -e "/>

And here is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)

## Compile as C++11, supported in ROS Kinetic and newer

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS

# Generate messages in the 'msg' folder

# Generate added messages and services with any dependencies listed here
   geometry_msgs   std_msgs

  CATKIN_DEPENDS geometry_msgs roscpp rospy std_msgs message_runtime

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
add_executable(turtle_exploration src/exploration.cpp)
add_executable(kill_turtle2 src/kill_turtle2.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(turtle_exploration ${catkin_LIBRARIES})
target_link_libraries(kill_turtle2 ${catkin_LIBRARIES})

catkin_make works fine, and I also have added export ROS_PACKAGE_PATH=~/catkin_ws/src:$ROS_PACKAGE_PATH and source ~catkin_ws/devel/setup.bash to my bashrc file. The problem is that when I run the launcher, I see the five nodes in the first list, but then I get the following error:

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

So, two nodes work as they should, but the other three don't. Does anyone know how to fix this? I read many answers to this kind of question but I din't got any results. Thank you.

PS: I'm using ROS Kinetic.

edit retag flag offensive close merge delete



The type of your exploration node should be turtle_exploration instead of exploration. Look at your CMakeLists.txt where you define the turtle_exploration executable.

l4ncelot gravatar image l4ncelot  ( 2018-11-30 02:57:48 -0500 )edit

Ohw, was it so easy? It works now, thank you.

Naukhel gravatar image Naukhel  ( 2018-11-30 11:48:57 -0500 )edit