All rapyuta.io docs are open source. See something that's wrong or unclear? Submit a pull request.
Make a contributionThis tutorial demonstrates how to have multi-device communication within the same LAN using the device native network
This tutorial will show you how to deploy a device native network locally for inter-device communication using rapyuta.io console.
20 minutes
In this tutorial, you will add three devices namely Native_Network_Device, Publisher Device and Subscriber Device. You will also create and deploy ROS Publisher and ROS Subscriber packages.
Ensure that the device must be of amd64 CPU architecture.
Native_Network_Device
I am a Device Native Network
Paste and execute the token in the device’s terminal to set up the rapyuta.io client on the device.
If the device is set up successfully, you should see the following output at the device’s terminal:
Initializing the Rapyuta Platform
############(100%)
Successfully Installed!
Ensure that there’s a green dot next to the Publisher Device, which indicates that it is online on rapyuta.io.
Once setup head to the device page on the rapyuta.io console and set the network_interface
variable to one of the interface you intend to use eg: enp1s0
Ensure that cpuset and memory cgroups are enabled.
For instance on a Raspberry-Pi consider adding the following in /boot/cmdline.txt. cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
The Publisher Device is:
The custom rapyuta.io image comes with Ubuntu Xenial OS and ROS Melodic Moreniasoftware installed on them. Moreover, the rapyuta.io tutorials are also installed on these custom images.
Learn how to prepare Raspberry PI
If you are using a custom rapyuta.io image on the device, the catkin workspace is already set up for you, the io_tutorials repository is already downloaded in the workspace, and the source code is already built for you.
In this tutorial, the catkin workspace is ~/catkin_ws/
, but you
may choose to name your catkin workspace as you like and ensure
that you replace all occurrences to ~/catkin_ws/
with your
workspace name.
If you are using either a computer with ROS Melodic installed on it, or a Raspberry PI without custom rapyuta.io image, you will create a catkin workspace and get the io_tutorials repository into the workspace.
To create the catkin workspace, you have to execute the below commands at the device’s terminal.
cd $HOME
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/rapyuta/io_tutorials
source /opt/ros/melodic/setup.bash
cd ..
For the custom rapyuta.io image to support the build command, catkin build, you will set up the device by executing the following:
cd $HOME &&
mv catkin_ws catkin_old &&
curl https://storage.googleapis.com/artifacts.rapyuta.io/io_tutorials/catkin_ws_arm32v7.tar.gz | tar xz
The argument to the curl command, i.e., the URL address, changes based on the architecture of the device.
To build the source code in the catkin workspace, execute the below command in the root of the workspace:
catkin build talker
If you experience the error catkin:command not found, then the python-catkin-tools package is missing on the device, which is required for executing catkin build command. Install the package by running the command sudo apt-get install python-catkin-tools
at the device terminal.
Publisher Device
/home/rapyuta/catkin_ws
. I am a ROS Publisher
Paste and execute the token in the device’s terminal to set up the rapyuta.io client on the device.
If the device is set up successfully, you should see the following output at the device’s terminal:
Initializing the Rapyuta Platform
############(100%)
Successfully Installed!
Ensure that there’s a green dot next to the Publisher Device, which indicates that it is online on rapyuta.io.
Once setup head to the device page on the rapyuta.io console and set the network_interface
variable to one of the interface you intend to use eg: enp1s0
Ensure that cpuset and memory cgroups are enabled.
For instance on a Raspberry-Pi consider adding the following in /boot/cmdline.txt. cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
The Subscriber Device is a:
The custom rapyuta.io image comes with Ubuntu Xenial OS and ROS Melodic Morenia software installed on them. Moreover, the rapyuta.io tutorials are also installed on these custom images.
Learn how to prepare Raspberry PI
If you are using a custom rapyuta.io image on the device, the catkin workspace is set up for you, the io_tutorials repository is downloaded in the workspace, and the source code is built for you.
In this tutorial, the catkin workspace is ~/catkin_ws/
, but you
may choose to name your catkin workspace as you like and ensure
that you replace all occurrences to ~/catkin_ws/
with your
workspace name.
If you are using either a computer with ROS installed on it or a Raspberry PI without custom rapyuta.io image, you will create a catkin workspace and get the io_tutorials repository into the workspace.
To create the catkin workspace, you have to execute the below commands at the device’s terminal:
cd $HOME
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/rapyuta/io_tutorials
source /opt/ros/melodic/setup.bash
cd ..
For the custom rapyuta.io image to support the build command, catkin build, you will set up the device by executing the following:
cd $HOME &&
mv catkin_ws catkin_old &&
curl https://storage.googleapis.com/artifacts.rapyuta.io/io_tutorials/catkin_ws_arm32v7.tar.gz | tar xz
The argument to the curl command, i.e., the URL address, changes based on the architecture of the device.
To build the source code in the catkin workspace, execute the below command in the root of the workspace:
catkin build listener
If you experience the error catkin:command not found, then the python-catkin-tools package is missing on the device, which is required for executing catkin build command. Install the package by running the command sudo apt-get install python-catkin-tools
at the device terminal.
Subscriber Device
/home/rapyuta/catkin_ws
I am a ROS Subscriber
Paste and execute the token in the device’s terminal to set up the device manager client on the device.
If the device is set up successfully, you should see the following output:
Initializing the Rapyuta Platform
############(100%)
Successfully Installed!
Ensure that there’s a green dot next to the Subscriber Device, which indicates that it is online on rapyuta.io.
Once setup head to the device page on the rapyuta.io console and set the network_interface
variable to one of the interface you intend to use eg: enp1s0
Ensure that cpuset and memory cgroups are enabled.
For instance on a Raspberry-Pi consider adding the following in /boot/cmdline.txt. cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
Click Development > Packages > ADD NEW PACKAGE.
You should provide information about the package such as the name of the package, its version, whether it is a singleton package, and a description.
ROS Publisher
Publishes ROS topic for a subscriber
In the Component Name box, enter a name for the component, for example, Publisher
Select Device as the Component Runtime.
Ensure Is ROS Component is selected.
Ensure the ROS Version is Melodic.
In the Executable Name box, type in a name for the executable, for example, talker
For Executable type, select Default because the source code is already installed on the Publisher Device.
In the Command to run in the docker container box, copy and paste the command:
roslaunch talker talker.launch
Ensure you always execute roslaunch command for explicitly starting 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.
To add a ROS topic, click Add ROS topic. In the Name box, enter /telemetry
and set QoS to Maximum.
Click NEXT > CONFIRM PACKAGE CREATION.
Click Development > Packages > ADD NEW PACKAGE.
You should provide information about the package such as the name of the package, its version, whether it is a singleton package, and a short description.
ROS Subscriber
Subscribes to ROS topic published by a publisher
In the Component Name box, enter a name for the component, for example, Subscriber
Select Device as the Component Runtime.
Ensure Is ROS Component is selected.
Ensure the ROS Version is Melodic.
In the Executable Name box, type in a name for the executable, for example, listener
For Executable type, select Default because the source code is already installed on the Subcriber Device.
In the Command to run in the docker container box, copy and paste the command:
roslaunch listener listener.launch
Ensure you always execute roslaunch command for explicitly starting 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.
Click NEXT > CONFIRM PACKAGE CREATION.
Follow these steps to create a device native network. Make sure you have a rapyuta.io registered device with docker runtime.
device_native_network_1
as the name for the native network.Native_Network_Device
and its IP Interface.The native network is getting deployed and is identical to the deployment of any other package and has identical corresponding phases and errors. Once the native network deployment succeeds, other ROS package deployments can bind to it and communicate.
ROS Publisher Deployment
device_native_network_1
as the network and in the IP Interfaces dropdown select the interface that was used while creating the native network.
You will be redirected to the Details tab of the newly created deployment. The package is successfully deployed when the green colored bar moves from In progress to Succeeded indicating that the DEPLOYMENT PHASE has Succeeded and the STATUS is Running.
You may analyze the corresponding deployment logs so you may debug if the deployment fails.
The corresponding dependency graph of ROS Publisher Deployment looks like:
ROS Subscriber Deployment
device_native_network_1
as the network and in the IP Interfaces dropdown select the interface that was used while creating the native network.
You will be redirected to the newly created deployment’s Details tab. The package is successfully deployed when the green colored bar moves from In progress to Succeeded indicating that the DEPLOYMENT PHASE has Succeeded, and the STATUS is Running.
You may analyze the corresponding deployment logs so you may debug if the deployment fails.
The corresponding dependency graph of ROS Subscriber Deployment looks like:
If all of the above three deployments are successfully running, the logs of ROS Subscriber Deployment will print hello_world.