Request: Allow Auto-Connection for rosbot (shm, raw-usb, gpio, serial)

Hi guys,

We have just tried to upload a new version of rosbot snap to the store. The target OS for this snap is Ubuntu Server. rosbot snap runs ROS 2 driver for our smallest mobile robot for research:

We have 3 interfaces that need human review: gpiochip-slot, serial-slot and shm-slot. Here is a part of our snapcraft.yaml:

slots:
  shm-slot:
    interface: shared-memory
    write: ['*'] # paths are relative to /dev/shm
  gpiochip-slot:
    interface: custom-device
    custom-device: gpiochip
    devices:
      # Raspberry Pi 4
      - /dev/gpiochip0
      # Raspberry Pi 5
      - /dev/gpiochip4
    files:
      read:
        - /sys/devices/platform/soc/*.gpio/gpiochip0/dev
        - /sys/devices/platform/axi/*.pcie/*.gpio/gpiochip4/dev
  serial-slot:
    interface: custom-device
    custom-device: ttyserial
    devices:
      - /dev/ttyAMA0
      - /dev/ttyS4
        
plugs:
  shm-plug:
    interface: shared-memory
    shared-memory: shm-slot
    private: false
  gpiochip-plug:
    interface: custom-device
    custom-device: gpiochip
  serial-plug:
    interface: custom-device
    custom-device: ttyserial

apps:
  daemon:
    command: usr/bin/launcher.sh
    command-chain: [usr/bin/ros_setup.sh]
    daemon: simple
    install-mode: enable
    plugs: [network, network-bind, shm-plug, raw-usb, serial-plug, gpiochip-plug]
    slots: [shm-slot, serial-slot, gpiochip-slot]
    extensions: [ros2-humble-ros-base]

  rosbot:
    command: usr/bin/launcher.sh
    command-chain: [usr/bin/check_daemon_running.sh, usr/bin/ros_setup.sh]
    plugs: [network, network-bind, shm-plug, raw-usb, serial-plug, gpiochip-plug]
    slots: [shm-slot, serial-slot, gpiochip-slot]
    extensions: [ros2-humble-ros-base]

  flash:
    command: usr/bin/flash_launcher.sh
    plugs: [raw-usb, network-bind, gpiochip-plug, serial-plug]
    slots: [gpiochip-slot, serial-slot]
    extensions: [ros2-humble-ros-base]

And here are the reasons why we need those interfaces:

  1. shm-slot: used for shared memory communication between ROS 2 nodes. The same interface was permitted in the rosbot-xl snap
  2. gpiochip-slot: ROSbot 2R is powered by Raspberry Pi 4. GPIO interface is needed for entering the STM32F4 microcontroller into the bootloader mode (controlling BOOT0 and RST signals from a Raspberry Pi pin header). This slot is done in a similar way as in matter-pi-gpio-commander snap by Canonical
  3. serial-slot: The same STM32F4 microcontroller is connected with RaspberryPi 4 over the /dev/ttyAMA0 interface available over the RPi4 pin header. Access to this interface is not possible with raw-usb or serial-port interfaces. We’re accessing /dev/ttyAMA0 the similar way as here: Allow installation and auto-connection of mulitple interfaces for console-conf snap

Additionally I would be grateful for auto-connection for the following interfaces:

sudo snap connect rosbot:raw-usb
sudo snap connect rosbot:shm-plug rosbot:shm-slot
sudo snap connect rosbot:gpiochip-plug rosbot:gpiochip-slot
sudo snap connect rosbot:serial-plug rosbot:serial-slot

Thanks a lot!

Best,

Dominik from Husarion

Inline with the previously submitted similar requests, this one as well make sense to me, therefore +1 from me. Thanks

1 Like

+1 from me as well for auto-connecting shared-memory, raw-usb and custome-device as it is inline with previous requests

thanks

1 Like

Hi guys, should we wait for additional votes or are you fine with allowing the auto-connection?

Thanks

Hey @Husarion

Sorry for the delay in the response. The request looks aligned with your other requests, however there is a new consideration regarding the gpiochip-slot. As you can see here we should probably not granting auto-connection for custom-device in the local store. Would manual connection for this interface work in your use case?

Thanks

Hi @jslarraz , thanks for your feedback. I think that my case is different: the snap is intended to be used only on a single board computer inside ROSbot that is Raspberry Pi 4 and will be Raspberry Pi 5 in the near future. I would be grateful for granting auto-connection then. Thanks!

1 Like

Hi guys, we would be grateful for a positive feedback about granting auto-connection to this interface in rosbot snap:

  gpiochip-slot:
    interface: custom-device
    custom-device: gpiochip
    devices:
      # Raspberry Pi 4
      - /dev/gpiochip0
      # Raspberry Pi 5
      - /dev/gpiochip4
    files:
      read:
        - /sys/devices/platform/soc/*.gpio/gpiochip0/dev
        - /sys/devices/platform/axi/*.pcie/*.gpio/gpiochip4/dev

I will appreciate that. This snap will work only on Raspberry Pi 4 and Raspberry Pi 5, so we don’t need to care much about making it as universal as possible.

Thanks and have a great weekend!

The problem we have is that since the snap is published in the global store, there is nothing stopping a regular users installing the rosbot snap on their system - ie. on my local x86 system I have a /dev/gpiochip0 device - what would happen if I installed rosbot on my system? Would it automatically go and try and configure the GPIOs assuming it was a RPi4 etc? Instead I think manual connection is more appropriate (plus you should ensure rosbot has appropriate checks in place to ensure that the expected device is actually present before it does any writes to any device files).

1 Like

Hi @alexmurray , sorry for the late reply.

All clear, please allow auto-connection for all other interfaces. gpiochip-slot will be connected manually by the user.

Thanks!

Hi @review-team,

I would be grateful for auto-connection for for shm-slot and serial-slot custom interfaces and for the acceptance of the gpiochip-slot interface (manual-connection).

It’s important for us to have the rosbot snap in the store. Thanks!

+3 for, 0 against. Granting rosbot auto-connection to shm-slot interface and manual connection to serial-slot and gpiochip-slot. The publisher is vetted. This is now live.

Please note that serial-slot is also using custom-device, so as far as I understand auto-connection should not be granted. However, maybe @alexmurray or @pedronis can clarify if it would be ok in this case that only tty devices are being used.

1 Like

Hi @review-team,

As highlighted in this forum thread, our snap was previously approved to use a custom gpiochip-slot interface, defined as follows:

  gpiochip-slot:
    interface: custom-device
    custom-device: gpiochip
    devices:
      # Raspberry Pi 4
      - /dev/gpiochip0
      # Raspberry Pi 5
      - /dev/gpiochip4
    files:
      read:
        - /sys/devices/platform/soc/*.gpio/gpiochip0/dev
        - /sys/devices/platform/axi/*.pcie/*.gpio/gpiochip4/dev

I’ve updated this configuration to also support the ROSbot 2 PRO setup, which uses the UpBoard single-board computer:

  gpiochip-slot:
    interface: custom-device
    custom-device: gpiochip
    devices:
      # Raspberry Pi 4
      - /dev/gpiochip0
      # Raspberry Pi 5 and UpBoard
      - /dev/gpiochip4
    files:
      read:
        # RPi 4
        - /sys/devices/platform/soc/*.gpio/gpiochip0/dev
        # RPi 5
        - /sys/devices/platform/axi/*.pcie/*.gpio/gpiochip4/dev
        # Up Board
        - /sys/devices/platform/up-pinctrl/gpiochip4/dev

However, I’ve encountered the following error message when reviewing revision 44 of the snap in the Snapcraft dashboard (rosbot snap revisions no 44):

Could you please approve this updated interface?

Thank you,

Dominik

+1 from me given the update to this interface. what do other @reviewers think?

1 Like

Thanks, @cav! I’d really appreciate additional feedback from someone on the @review-team, as it’s crucial for us to release the snap for ROSbot 2 PRO as soon as possible. Thank you!

+1 from me too. +2 votes for, 0 votes against, granting updated custom-device declaration for rosbot to include this new path. This is now live.

@Husarion FYI in future it may be better to create a separate forum post for additional changes like this to make sure they don’t slip through the cracks.

1 Like