Communication between ROS2 in container and Matlab in Host machine

조회 수: 31 (최근 30일)
Nupur
Nupur 2023년 11월 27일
편집: Nupur 2024년 3월 6일
I am trying to develop a connection between the ROS2 and the Matlab. ROS2 which is installed inside the container and Matlab is installed in the Host machine. Both the container and Matlab is running in the same host machine (Ubuntu 22.04).
Matlab is being able to show the topics from the host terminal however, the topics from the container has not been shown in Matlab.
I have given the same ROS_DOMAIN_ID but still Matlab has not been able to shown the topics from container.
Matlab version: 2022b
ROS2 : humble
I guess there is some settings that I am missing.
I appreciate any help. Thank you
UPDATE: I changed the RMW Middleware Implementation setting in Simulink same as ROS2 container and it works!!!

답변 (1개)

Divyanshu
Divyanshu 2023년 12월 21일
Hi Nupur,
A possible reason that you are not able to communicate between MATLAB and ROS2 container is that these two systems might be on two different subnets.
Please consider the following points related to ROS2 and for possible workaround:
  • In ROS 2, there is no master, so each node has to act as its own master. Because of this, it is a little harder to define exactly where a "network" boundary is. For ROS 2, an entity's network is defined instead by both its subnet and its domain ID.
  • Generally, If the two systems that want to communicate, but aren't on the same subnet. You can explicitly make them available to each other by creating the DEFAULT_FASTRTPS_PROFILES.xml file. In this put both the host machine's IP and the container IP in this file, and put this file on both systems.
  • Please make sure that the .xml file has the correct DomainID that they will be using for communication.
  • If a system has multiple network interfaces, you may have to experiment to determine which one ROS 2 is using for communication. It also probably cannot hurt to just put all associated IDs down in the file, get communication working, and remove what if unnecessary.
Hope it helps!

카테고리

Help CenterFile Exchange에서 ROS Network Access in MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by