Difference between revisions of "Advantech Robotic Suite/ROS DOMAIN ID"

From ESS-WIKI
Jump to: navigation, search
Line 5: Line 5:
  
 
= Prerequisite =
 
= Prerequisite =
Please make sure that ROS2 Suite v1.3.0 or higher have been installed in your environment.<br>
+
Please make sure that ROS2 Suite v1.3.0 or higher have been installed in your environment.
Currently, this function only supports for ROS2 humble.  
 
  
 
= How to =
 
= How to =
== Set ROS_DOMAIN_ID ==
+
=== Set ROS_DOMAIN_ID of the ROS2 Suite Application ===
<span style="font-size:larger;">Command for set ROS_DOMAIN_ID of the ROS2 Suite application.</span>
+
<span style="font-size:larger;">Command for set ROS_DOMAIN_ID of the ROS2 suite application.</span>
 +
<span style="color:red;">Note: Currently, this function only supports for ROS2 humble.</span>
 
<pre>
 
<pre>
 
$ cd /usr/local/Advantech/ros
 
$ cd /usr/local/Advantech/ros
Line 16: Line 16:
 
</pre>
 
</pre>
 
<br>
 
<br>
<span style="font-size:larger;">It can also be manually set ROS_DOMAIN_ID in host or container by following steps.</span><br>
+
 
*Set ROS_DOMAIN_ID in host
+
=== Set ROS_DOMAIN_ID in Host Manually ===
 
Please refer to [[ROS2_Suite/Q&A#How_to_set_ROS_DOMAIN_ID_in_host|Q&A : How to set ROS_DOMAIN_ID in host]]
 
Please refer to [[ROS2_Suite/Q&A#How_to_set_ROS_DOMAIN_ID_in_host|Q&A : How to set ROS_DOMAIN_ID in host]]
 +
<br><br>
  
*Set ROS_DOMAIN_ID in docker container
+
=== Set ROS_DOMAIN_ID in Docker Container Manually ===
Step1: open docker-compose.yml
+
Step1: Open docker-compose.yml
 
<pre>
 
<pre>
 
$ cd /usr/local/Advantech/ros/container/docker/docker-compose/<docker_container_name>
 
$ cd /usr/local/Advantech/ros/container/docker/docker-compose/<docker_container_name>
 
$ vim docker-compose.yml
 
$ vim docker-compose.yml
 
</pre>
 
</pre>
Step2: set ROS_DOMAIN_ID=<your_domain_id>
+
Step2: Set ROS_DOMAIN_ID=<your_domain_id> in docker-compose.yml
 
  .
 
  .
 
  .
 
  .
Line 35: Line 36:
 
  .
 
  .
 
  .
 
  .
Step3: restart container for update environment variables of docker container
+
Step3: Restart container for update environment variables of docker container
 
<pre>
 
<pre>
 
$ cd /usr/local/Advantech/ros/container/docker
 
$ cd /usr/local/Advantech/ros/container/docker

Revision as of 04:17, 31 May 2023

Introduction

ROS 2 uses for communication is DDS. In DDS, the primary mechanism for having different logical networks share a physical network is known as the Domain ID. ROS 2 nodes on the same domain can freely discover and send messages to each other, while ROS 2 nodes on different domains cannot. All ROS 2 nodes use domain ID 0 by default. To avoid interference between different groups of computers running ROS 2 on the same network, a different domain ID should be set for each group.

You'll have to set ROS domain ID while installation, for Advantech ROS2 Suite, you can choose a domain ID between 0 and 101.

Prerequisite

Please make sure that ROS2 Suite v1.3.0 or higher have been installed in your environment.

How to

Set ROS_DOMAIN_ID of the ROS2 Suite Application

Command for set ROS_DOMAIN_ID of the ROS2 suite application. Note: Currently, this function only supports for ROS2 humble.

$ cd /usr/local/Advantech/ros
$ bash -i change-ros-domain-id.sh


Set ROS_DOMAIN_ID in Host Manually

Please refer to Q&A : How to set ROS_DOMAIN_ID in host

Set ROS_DOMAIN_ID in Docker Container Manually

Step1: Open docker-compose.yml

$ cd /usr/local/Advantech/ros/container/docker/docker-compose/<docker_container_name>
$ vim docker-compose.yml

Step2: Set ROS_DOMAIN_ID=<your_domain_id> in docker-compose.yml

.
.
.
   environment:
    - ROS_DOMAIN_ID=<your_domain_id>
.
.
.

Step3: Restart container for update environment variables of docker container

$ cd /usr/local/Advantech/ros/container/docker
$ ./stop.sh <docker_container_name>
$ ./launch.sh <docker_container_name>