ERROR: cannot launch node of type [...]: can't locate node [...] in package [...]
This system is running Ubuntu 16.04 64bit with Kinetic. The project builds properly with catkin_make
; and right after source devel/setup.bash
is run in the same terminal. As soon as the project is launched via roslaunch jimmy_lidar_motor_control lidar_motor_control.launch
the following error appears:
ERROR: cannot launch node of type [jimmy_lidar_motor_control/lidar_motor_control]: can't locate node [lidar_motor_control] in package [jimmy_lidar_motor_control]
The project structure is pretty standard:
└── src
├── jimmycpp
│ ├── //unrelated files (I think)
│ ├── //unrelated files (I think)
│ └── //unrelated files (I think)
└── jimmy_lidar_motor_control
├── CMakeLists.txt
├── include
│ └── jimmy_lidar_motor_control
│ └── lidar_motor_control.h
├── launch
│ └── lidar_motor_control.launch
├── msg
│ └── motion_command_to_execute.msg
├── package.xml
└── src
└── lidar_motor_control.cpp
the launch file is very simple:
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<node name="jimmy_lidar_motor_control_mynode"
pkg="jimmy_lidar_motor_control"
type="lidar_motor_control"
output="screen"/>
</launch>
To figure out what files ROS can "see" i ran rosrun command and pressed TAB-TAB, and all the files in the directory are visible:
mo@Home-W530:~/Desktop/workspace$ rosrun jimmy_lidar_motor_control
CMakeLists.txt lidar_motor_control.launch
jimmy_lidar_motor_control_node motion_command_to_execute.msg
lidar_motor_control.cpp package.xml
lidar_motor_control.h
Everything is in C++ so I don't think it's related to file permissions (output of ls -la
):
-rwxrwxrwx 1 mo mo 7287 Jan 19 12:32 lidar_motor_control.cpp
All the questions I looked through did not solve my issue:
- https://answers.ros.org/question/1458...
- https://answers.ros.org/question/2912...
- everything else that was relevent was really old (5 years or so)
Here is the CMakeLists.txt in case the issue is there:
# What version of CMake is needed?
cmake_minimum_required(VERSION 2.8.3)
project(jimmy_lidar_motor_control)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
jimmycpp
message_generation
)
#declare any custom files that I have created
add_message_files(
FILES
motion_command_to_execute.msg
)
#the custom message I am declaring relies on data types found here
generate_messages(DEPENDENCIES std_msgs )
catkin_package(
INCLUDE_DIRS include
# LIBRARIES my_robot_base
CATKIN_DEPENDS roscpp message_runtime
# DEPENDS system_lib
)
# Specify locations of header files.
include_directories(include ${catkin_INCLUDE_DIRS})
# NOTE: executable name and source file name should be the same!!!!
add_executable(${PROJECT_NAME}_node src/lidar_motor_control.cpp)
target_link_libraries(${PROJECT_NAME}_node serial ${catkin_LIBRARIES})
# this line is to be used anytime I am using custom messages. It prevents build
# errors when I run `catkin_make`. The first argument is the same name as the
# name of the source file. The second argument is the name of the package plus
# add “_generate_messages_cpp”. This solution to my problem is described on
# http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber(c%2B%2B) in section
add_dependencies(${PROJECT_NAME}_node
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
jimmy_lidar_motor_control_generate_messages_cpp
)
in case the entire output of roslaunch jimmy_lidar_motor_control lidar_motor_control.launch
which causes this problem is useful, here it is:
mo@Home-W530:~/Desktop/workspace$ roslaunch jimmy_lidar_motor_control lidar_motor_control.launch
... logging to /home/mo/.ros/log/749beb5c-3ae5-11ea-9996-e09d3128cfa4/roslaunch-Home-W530-6823.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://Home-W530:37099/
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
/
jimmy_lidar_motor_control_mynode (jimmy_lidar_motor_control/lidar_motor_control)
auto-starting new ...