Request: Allow Interfaces for `husarion-ugv` (shm, gpio, spi, ...)

Hello everyone,

We’ve just published our first release of the husarion-ugv snap to Snap Store. This snap — the third in our series of ROS 2-powered robot platform snaps (alongside rosbot and rosbot-xl snaps) — supports our largest platforms: Panther and Lynx UGVs. It’s intended to run exclusively on the built-in (embedded) computer in the Panther (or Lynx) UGV, running Ubuntu Server on a Raspberry Pi single board computer (SBC). As such, it needs access to certain Pi hardware interfaces.

name

husarion-ugv

description

husarion-ugv is the third in our series of ROS 2-powered robot platform snaps (after rosbot and rosbot-xl). It supports our largest UGV platforms, Panther and Lynx, and is designed to run exclusively on the embedded Raspberry Pi within the vehicle, running Ubuntu Server. The snap requires access to specific Raspberry Pi hardware interfaces (GPIO, SPI, etc.) and read-only access to certain system files and directories to properly gather configuration data and determine if a real-time kernel is in use.

snapcraft

PRIVATE (repository is not publicly available). Below is the most interesting part of the snapcraft.yaml

name: husarion-ugv
adopt-info: husarion-ugv
summary: ROS 2 Driver for Husarion UGV platforms
description: |
  ROS packages composing the basic functionalities of the Husarion UGV robots.

grade: stable
confinement: strict
base: core22

contact: https://husarion.com/
website: https://husarion.com/manuals/panther/overview/

apps:
  husarion-ugv: &husarion-ugv
    command: usr/bin/launcher.sh
    plugs:
      - shm-plug
      - gpiochip-plug
      - spi-plug
      - can-bus
      - hardware-observe
      - network
      - network-bind
      - network-observe
      - process-control
      - raw-usb
      - run-husarion
      - sys-kernel-realtime
    slots:
      - shm-slot
      - gpiochip-slot
      - spi-slot
    environment:
      LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack"
      RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
    extensions:
      - ros2-{{ ros_distro }}-ros-base

...

plugs:
  shm-plug:
    interface: shared-memory
    shared-memory: shm-slot
    private: false
  gpiochip-plug:
    interface: custom-device
    custom-device: custom-gpiochip
  spi-plug:
    interface: custom-device
    custom-device: custom-spi
  run-husarion:
    interface: system-files
    read:
      - /run/husarion
  sys-kernel-realtime:
    interface: system-files
    read:
      - /sys/kernel/realtime

slots:
  shm-slot:
    interface: shared-memory
    write: ['*'] # paths are relative to /dev/shm
  gpiochip-slot:
    interface: custom-device
    custom-device: custom-gpiochip
    devices:
      # Raspberry Pi 4
      - /dev/gpiochip0
      # Raspberry Pi 5
      - /dev/gpiochip4
    files:
      read:
        # RPi 4
        - /sys/devices/platform/soc/*.gpio/gpiochip0/dev
        # RPi 5
        - /sys/devices/platform/axi/*.pcie/*.gpio/gpiochip4/dev
  spi-slot:
    interface: custom-device
    custom-device: custom-spi
    devices:
      - /dev/spidev0.[0-1]
    files:
      read:
        - /sys/devices/platform/soc/*.spi/spi_master/spi0/spi0.[0-1]/spidev/spidev0.[0-1]/dev

upstream:

PRIVATE (repository is closed-source)

upstream-relation

We are the upstream developers and maintainers of this snap.

Interfaces

Below are the interfaces our snap requires, along with the type of request (installation/connection/auto-connection) and a brief explanation:

  1. shm-slot (shared-memory)
  1. gpiochip-slot (custom-device)
  1. spi-slot (custom-device)
  • request-type: installation & auto-connection
  • reasoning: Permits SPI communications on Raspberry Pi. Needed for certain on-board peripherals in the UGV.
  1. sys-kernel-realtime (system-files)
  • request-type: installation & auto-connection
  • reasoning: Provides read-only access to /sys/kernel/realtime. Used to verify if the OS is running a real-time kernel, crucial for ROS 2 real-time operations. No write capabilities are requested.
  1. run-husarion (system-files)
  • request-type: installation & auto-connection
  • reasoning: Provides read-only access to /run/husarion, which stores device-specific configuration files (e.g., unique robot info, serial number). Required to properly identify and manage the UGV without any possibility of altering system behavior.
  1. can-bus
  • request-type: auto-connection
  • reasoning: Enables communication with motor drivers and other components via CAN bus.
  1. hardware-observe
  • request-type: auto-connection
  • reasoning: Allows read-only observation of various hardware properties for diagnostics (e.g., CPU, memory usage).
  1. network-observe
  • request-type: auto-connection
  • reasoning: Enables monitoring of network status for remote management of the robot.
  1. process-control
  • request-type: auto-connection
  • reasoning: Permits managing processes inside the snap, which is necessary for launching and controlling multiple ROS 2 nodes and related services.
  1. raw-usb
  • request-type: auto-connection
  • reasoning: Required to communicate directly with various USB-connected module inside the UGV.

Currently after installation of the snap, we have to connect all interfaces manually with the command below:

sudo snap connect husarion-ugv:shm-plug husarion-ugv:shm-slot
sudo snap connect husarion-ugv:gpiochip-plug husarion-ugv:gpiochip-slot
sudo snap connect husarion-ugv:spi-plug husarion-ugv:spi-slot
sudo snap connect husarion-ugv:can-bus
sudo snap connect husarion-ugv:hardware-observe 
sudo snap connect husarion-ugv:network-observe
sudo snap connect husarion-ugv:process-control
sudo snap connect husarion-ugv:raw-usb 
sudo snap connect husarion-ugv:run-husarion 
sudo snap connect husarion-ugv:sys-kernel-realtime 

We’d be very grateful for your assistance in reviewing these interfaces and facilitating the necessary auto-connections. Thank you for your time, and we look forward to your feedback.

Best,

Dominik from Husarion

2 Likes

Hello Dominik, thanks for the information!

+1 from me for auto-connection of shm-slot, gpiochip-slot, spi-slot, sys-kernel-realtime, run-husarion, can-bus, hardware-observe, network-observe, process-control, raw-usb interfaces to snap husarion-ugv.

1 Like