Difference between revisions of "Advantech Robotic Suite/ROS DOMAIN ID"
Eric.liang (talk | contribs) |
Eric.liang (talk | contribs) |
||
Line 10: | Line 10: | ||
Supported Platform: x86_64 | Supported Platform: x86_64 | ||
+ | |||
= How to = | = How to = | ||
− | === Set ROS_DOMAIN_ID | + | === Set ROS_DOMAIN_ID === |
− | <span style="font-size:larger;">Script for set ROS_DOMAIN_ID | + | <span style="font-size:larger;">Script for set ROS_DOMAIN_ID </span> |
<pre>$ cd /usr/local/Advantech/ros | <pre>$ cd /usr/local/Advantech/ros | ||
$ ./change-ros-domain-id.sh | $ ./change-ros-domain-id.sh | ||
Line 31: | Line 32: | ||
| | ||
− | === Set ROS_DOMAIN_ID | + | === Set ROS_DOMAIN_ID by 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/> | |
=== Set ROS_DOMAIN_ID in docker container manually === | === 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> in docker-compose.yml'''<br> | + | |
− | <span style="color:red;">Note: If you want to follow the host's ROS_DOMAIN_ID variable, please set ROS_DOMAIN_ID=${ROS_DOMAIN_ID}</span> | + | '''Step2: Set ROS_DOMAIN_ID=<your_domain_id> in docker-compose.yml'''<br/> <span style="color:red;">Note: If you want to follow the host's ROS_DOMAIN_ID variable, please set ROS_DOMAIN_ID=${ROS_DOMAIN_ID}</span> |
+ | |||
. | . | ||
. | . | ||
Line 51: | Line 53: | ||
. | . | ||
. | . | ||
+ | |||
'''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 | ||
$ ./stop.sh <docker_container_name> | $ ./stop.sh <docker_container_name> | ||
$ ./launch.sh <docker_container_name> | $ ./launch.sh <docker_container_name> | ||
</pre> | </pre> | ||
+ | |||
'''Step4: Confirm whether the variable is modified successfully in container''' | '''Step4: Confirm whether the variable is modified successfully in container''' | ||
− | <pre> | + | <pre>$ docker exec -it <docker_container_name> bash |
− | $ docker exec -it <docker_container_name> bash | ||
$ echo $ROS_DOMAIN_ID | $ echo $ROS_DOMAIN_ID | ||
</pre> | </pre> |
Revision as of 03:39, 2 June 2023
Contents
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.
The ROS2 Suite offers a convenient method for modifying the ROS domain ID (default is 0).
Prerequisite
Supported Version: ROS2 Suite v1.3.0 or higher.
Supported Platform: x86_64
How to
Set ROS_DOMAIN_ID
Script for set ROS_DOMAIN_ID
$ cd /usr/local/Advantech/ros $ ./change-ros-domain-id.sh
Confirm whether the variable is modified successfully in host.
$ echo $ROS_DOMAIN_ID
Confirm whether the variable is modified successfully in container.
$ docker exec -it edge-ros2-foxy bash $ echo $ROS_DOMAIN_ID
Set ROS_DOMAIN_ID by 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
Note: If you want to follow the host's ROS_DOMAIN_ID variable, please set ROS_DOMAIN_ID=${ROS_DOMAIN_ID}
.
.
.
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>
Step4: Confirm whether the variable is modified successfully in container
$ docker exec -it <docker_container_name> bash $ echo $ROS_DOMAIN_ID