Assistance in building snap-based ros system

I am looking to distribute a snap-based ROS system based on the instructions from DIstributing multiple snaps but have not been successful. The error i got at the end is

/snap/ros-rplidar/x1/bin/run-system: line 29: roslaunch: command not found

Here is my tree

catkin_ws/src
└── snap
├── roscore
│   └── snapcraft.yaml
└── rplidar
    ├── bin
    │   └── run-system
    ├── roscore.tar.bz2
    └── snapcraft.yaml

I have built the roscore.tar.bz2 according to the snapcraft.yaml file below

This is my snapcraft.yaml for the roscore:

name: roscore
version: '1.0'
grade: stable
confinement: strict
summary: ROS Base Snap
description: Contains roscore and basic ROS utilities.

slots:
    slot-roscore:
        content: ROS-master
        interface: content
        read: [/]

parts:
    roscore:
        plugin: catkin
        rosdistro: kinetic
        include-roscore: true
        catkin-packages: []

This is my snapcraft.yaml for my ros-app (rplidar)

name: ros-rplidar
version: '1.0'
grade: stable
confinement: strict
summary: RPlidar snap 
description: Contains driver and launch files for RPLidar

plugs:
    plug-roscore:
        content: ROS-master
        interface: content
        target: /roscore

apps:
    launch-project:
    command: run-system
    plugs: [network, network-bind, plug-roscore]

parts:
    roscore:
        plugin: dump
        source: roscore.tar.bz2
        prime: [-*]

    ros-rplidar:
        plugin: catkin
        rosdistro: kinetic
        include-roscore: false
        stage-packages: [ros-kinetic-rplidar-ros]
        underlay:
            build-path: $SNAPCRAFT_STAGE/opt/ros/kinetic
            run-path: $SNAP/ros-base/opt/ros/kinetic
        after: [roscore]

run-system:
    plugin: dump
    stage: [bin/run-system]
    prime: [bin/run-system]

mountpoint:
     plugin: nil
     override-build: mkdir $SNAPCRAFT_PART_INSTALL/roscore

And here is my bin/run-system

#!/bin/bash

case $SNAP_ARCH in 
arm64)
    export TRIPLET=arm64-linux-gnu
    ;;
*)
    echo "Unsupported arch: $SNAP_ARCH"
    exit 1
    ;;
esac

export ROSCORE=$SNAP/roscore

export PYTHONPATH=$PYTHONPATH:$ROSCORE/usr/lib/python2.7/dist-packages

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROSCORE/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROSCORE/lib/$TRIPLET
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROSCORE/usr/lib
export     LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROSCORE/usr/lib/$TRIPLET

roslaunch rplidar_ros rplidar.launch

Error was mine. Did not point run-path in the underlay to the correct directory.

1 Like