Roslaunch Snap Error = ERROR: cannot launch node of type [sick_app/node_filter]: Cannot locate node of type [node_filter] in package [sick_app]

Hi everyone

I’m trying to build a snap from a ROS project package. I’m currently working on Ubuntu 18.04 and ROS Melodic, and our plan is to deploy the package on different Linux distros (Red Hat, CentOS, Fedora, Ubuntu, etc).

The project’s structure is:

sick_app
- config
- - param.yaml (configuration file)
- launch
- - node_filter.launch
- - …Other launch files.
- msg
- - Img.msg (custom msg file)
- srv
- - model.srv (custom srv file)
- scripts
- - .py script files
- src
- - filter.h
- - filter.cpp
- - node_filter.cpp
- - … Other cpp/hpp files.
- CMakeLists.txt
- package.xml

Inside the node_filter.cpp file we init the node_filter. The node_filter.launch file is:

<launch>
  <arg name="config_dir" value="/path/to/config/param.yaml" />
  <rosparam file="$(arg config_dir)" />
  <node pkg="sick_app" name="node_filter" type="node_filter" output="screen"> </node>
</launch>

Here is a copy of the package.xml file. I’m using those packages, specially the sick_scan package http://wiki.ros.org/sick_scan

<?xml version="1.0"?>
<package format="2">
  <name>sick_app</name>
  <version>0.0.0</version>
  <description>The sick_app package</description>

  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>tf</build_depend>
  <build_depend>eigen</build_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>sick_scan</build_depend>
  <build_depend>roslaunch</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <build_export_depend>message_runtime</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>tf</exec_depend>
  <exec_depend>eigen</exec_depend>
  <exec_depend>message_runtime</exec_depend>
  <exec_depend>sick_scan</exec_depend>


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

Here is my CMakeLists.txt file

cmake_minimum_required(VERSION 3.0.2)
project(sick_app)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
tf
genmsg
sick_scan
roslaunch
)
find_package(Eigen3 REQUIRED)
roslaunch_add_file_check(launch)

add_service_files(
FILES
model.srv
)

add_message_files(
FILES
Img.msg
)

generate_messages(
DEPENDENCIES
std_msgs
sick_app
)

catkin_package(
CATKIN_DEPENDS message_runtime std_msgs sick_scan )

include_directories(src ${EIGEN3_INCLUDE_DIRS})
include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(node_filter
src/node_filter.cpp
src/filter.cpp
)
target_link_libraries(node_filter ${catkin_LIBRARIES} )
add_dependencies(node_filter sick_app_generate_messages_cpp)

install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

And finally, here’s the snapcraft.yaml file, where I want to generate the sick-snap-test.filter app to run the roslaunch command. I’m following the ROS tutorials " Packaging your ROS project as a snap"

name: sick-snap-test 
base: core18 
version: '0.1' 
summary: Sick app snap test
description: |
  Demo snapcraft for ROS sick application.

grade: devel 
confinement: devmode 

parts:
  sick-app-workspace:
    # See 'snapcraft plugins'
    plugin: catkin
    source: .
    catkin-packages: [sick_app]

apps:
  filter:
    command: roslaunch sick_app node_filter.launch
    plugs: [network, network-bind]

The error occurs after I generate and install the sick-snap-test_0.1_amd64.snap file. I installed it using the command:

sudo snap install --dangerous --devmode sick-snap-test_0.1_amd64.snap

Then I try to run the sick-snap-test.filter, but I’m getting this:

Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://colseinavc-NUC7i3BNH:33357/

SUMMARY
========

PARAMETERS
 * /lane_A/height_A: 5.9
 * /lane_A/lim_max_A: 4.7
 * /lane_A/lim_min_A: 1.3
 * /lane_B/height_B: 5.9
 * /lane_B/lim_max_B: -1.1
 * /lane_B/lim_min_B: -4.5
 * /model/CELLS_X: 300
 * /model/CELLS_Z: 120
 * /model/filename: 
 * /model/lane_A: 1
 * /model/lane_B: 2
 * /model/velocity_A: 2.0
 * /model/velocity_B: 5.0
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /run_id: b31f216e-291e-11e...
 * /storage/lim_IMG: 30000
 * /storage/lim_PTS: 20000

NODES
  /
    node_filter (sick_app/node_filter)

auto-starting new master
process[master]: started with pid [7032]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to d8ee594c-6b2b-11eb-aa52-f8633ff5a68b
process[rosout-1]: started with pid [7043]
started core service [/rosout]
ERROR: cannot launch node of type [sick_app/node_filter]: Cannot locate node of type [node_filter] in package [sick_app]. Make sure file exists in package path and permission is set to executable (chmod +x)

It seems to be a problem with the launch command, and I can’t find any information at the tutorials or forums with this problem. Please help me, what I’m doing wrong?

Thanks for your time
Best regards.

Hey there @camilopq97, welcome to the community!

Based solely on a quick pass through the code you shared, this looks like a pretty classic lack of installation rules. According to your CMakeLists.txt, all you’re installing are launch files:

install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

You need to be installing the node_filter executable as well. Anything that you want to run (e.g. binaries or scripts), have available while running (e.g. configuration files) or make available to other nodes (e.g. libraries) will need to be installed. ROS 1 makes this easy to forget due to its use of the devel space, thankfully ROS 2 got rid of that concept.

When iterating, I suggest trying things out by using the install space (catkin_make install or catkin_make_isolated --install, whichever fits into your existing workflow), which will require you to have proper installation rules. If your install space works, then the snap should also work.

2 Likes

Hi @kyrofa.
Thanks for your answer, you were right. The issue was the installation rules at CmakeList.txt.
Regards.

1 Like