Docker Runtime

A ROS publisher is part of a ROS package. It is a public git repository, which is built into a running docker container on the fly when the package is being deployed. A ROS subscriber is also a part of the same ROS package. It is downloaded on a device and is launched when the package is deployed.

Learning objectives

The tutorial will show you how to deploy a basic ROS package with a ROS publisher running on the cloud and a ROS subscriber running on a device such as Raspberry PI. It also shows how to use dockercompose runtime on a device.

Prerequisites

  1. Device requirements
    1. You should have access to a device (computer or Raspberry PI 2 or 3) with an internet connection.
    2. Ensure that the Google Chrome browser is installed on the computer.
    3. Ensure that the ROS Kinetic Kame is installed on the device.

      If the device has ROS Melodic Morenia installed on it, replace Kinetic with Melodic in all places where a specific version of ROS is asked for. The tutorial should still work the same.

  2. You should be familiar with the below tools:
    1. Git
    2. UNIX/LINUX command terminal
    3. ROS topics
    4. ROS services

Difficulty

Beginner

Estimated time

15 minutes

Preparing your device

The tutorial will use Raspberry PI as the device. Learn how to prepare your Raspberry PI

Setting up your device

To integrate the device into rapyuta.io using the console:

  1. Add the device to the console. Ensure that you select the Use docker compose as default runtime checkbox while adding the device.

Creating the package

To create the Docker publisher subscriber package using the console, follow the steps:

  1. On the left navigation bar, click CATALOG.
  2. Click ADD NEW PACKAGE.
  3. In the Package Name box, type in a name for the package say Docker publisher subscriber
  4. In the Package Version box, enter the version of the package you are creating. The default value is 1.0.0
  5. Ensure Is a singleton package is not selected.
  6. Make sure Is a bindable package is selected.
  7. In the Description box, provide a summary of the package.
  8. Click NEXT.

The package has two components: the talker running on the cloud and the listener running on the device.

  1. Talker component (aka ROS publisher)

    1. In the Component Name box, enter a name for the component, say talker

      The name of a component must consist of alphabets [A-Z, a-z], digits [0-9], hyphen - and an underscore _ character. It must not begin with a digit.

    2. For Component Runtime, click Cloud.
    3. Ensure Is ROS Component is selected.
    4. Set the value of Replicas to run the component to the number 1 (default value).
    5. In the Executable Name box, enter a name for the executable say talkerExecutable

      The name of an executable must consist of alphabets [A-Z, a-z], digits[0-9], hyphen - and an underscore _ character, and must not start with a digit.

    6. For Executable Type, click Git.
    7. In the Git repository box, enter the url address: https://github.com/rapyuta/io_tutorials
    8. In the Command to run in the docker container box, enter the command:

      roslaunch talker talker.launch
      

      Ensure you always execute the command roslaunch to explicitly start the ROS Master instead of running the rosrun command, because the ROS Master will fail to start on rosrun, and eventually, the deployment will fail as well. talkerExecutable

    9. The talkerExecutable publishes a ROS topic, /telemetry
      To add a ROS topic, click Add ROS topic. In the Name box, enter the name of the ROS topic. Select Maximum for QoS.

  2. Listener component (aka ROS subscriber)

    1. In the Component Name box, type in a name for the component, say listener

      The name of a component must consist of alphabets [A-Z, a-z], digits [0-9], hyphen - and an underscore _ character, and must not begin with a digit.

    2. For Component Runtime, click Device.
    3. Ensure Is ROS Component is selected.
    4. Ensure the ROS Version is Kinetic.
    5. Select arm32v7 as Architecture.
    6. In the Executable Name box, type in a name for the executable say listenerExecutable

      The name of an executable must consist of alphabets [A-Z, a-z], digits [0-9], hyphen - and an underscore _ character, and must not begin with a digit.

    7. For Executable Type, select Git.
    8. In the Git repository box, enter the URL address: https://github.com/rapyuta/io_tutorials
    9. In the Command to run in the docker container box, enter the command:

      roslaunch listener listener.launch
      

      Ensure you always execute the command roslaunch to explicitly start the ROS Master instead of running the rosrun command, because the ROS Master will fail to start on rosrun, and eventually, the deployment will fail as well.

    10. Click NEXT > CONFIRM PACKAGE CREATION.

The package takes about two to five minutes to build the source code in the io_tutorials repository into a running docker container. You may analyze the corresponding build logs, which help debug failing builds.

A flickering yellow dot against the name of the package indicates that the Build Status is New, while a green dot indicates that the Build Status is Complete.

Additionally, when the Deploy package button is automatically enabled, it indicates that the Docker publisher subscriber package has been successfully built and can be deployed.

Deploying the package

To deploy a package using the console, follow the steps:

  1. On the left navigation bar, click CATALOG.
  2. Select the Docker publisher subscriber package.
  3. Click Deploy package.
  4. In the Name of deployment box, enter a name for the deployment you are creating say Docker Publisher Subscriber Deployment
  5. Since listener has device runtime, you must select the device you want to deploy the component on. Click Refresh the list of online devices to retrieve an updated list of online devices.
  6. Select the device from the Select device for deploying the component dropdown list.
  7. Click CREATE DEPLOYMENT > Confirm.

You will be redirected to the newly created deployment’s Details page where a green colored bar moves from In progress to Succeeded with Status:Running indicating that the DEPLOYMENT PHASE has Succeeded, and the STATUS is Running.

You may also analyse the corresponding deployment logs to check if everything is working OK.

Docker Publisher Subscriber Deployment

The listener-listenerExecutable will be streaming /listener I heard hello_world logs.

ROS Subscriber logs

while talker-talkerExecutable will be publishing hello_world logs.

ROS Publisher logs