MATLAB与云服务器中ROS2的通信是否可行

我在MATLAB中想要与云服务器上的ROS Humble进行通信,使用ROS TOOLBOX配置好IP和用户名以及密码后在simulink内测试连接成功,配置和测试结果如下图,但是通过simulink程序向ROS发送消息后,无法在云服务器中的ROS内查看到话题。但是如果是在同一个局域网下就可以通过ROS TOOLBOX进行通信,一旦上云,就会通信失败。同时我也尝试过配置FastDDS,在云服务器的ROS发布消息后同样无法在MATLAB命令行查看到话题。现在我想确定这种通信的可行性,如果可行的话请告诉我应该如何解决。

Antworten (1)

Ritam
Ritam am 15 Apr. 2026 um 5:29

0 Stimmen

Yes, communicating with ROS 2 (Humble) from MATLAB is feasible, but cloud and cross-network setups often require additional configuration beyond what works on a local LAN. If your Simulink connection test succeeds but topics are not visible, consider the following checks:
  • Network discoverability: On Windows, ensure the active network profile is set to Private, as Public networks can block DDS discovery.
  • RMW implementation: Try switching from “fastrtps” to “cyclonedds” on both MATLAB and the ROS host to rule out middleware-specific discovery issues.
  • Fast DDS configuration: If using “fastrtps”, clear the cache ("C:\ProgramData\eprosima" on Windows), terminate any running “libmwros2server” process, and configure a “DEFAULT_FASTRTPS_PROFILES.xml” file to explicitly allow cross-host communication.
  • Cloud / Docker networking: Make sure ROS 2 nodes advertise reachable IP addresses. DDS discovery often fails if nodes run in containers or VMs with different subnets unless allowed explicitly via DDS XML profiles.
  • ROS_DOMAIN_ID consistency: Verify the same ROS_DOMAIN_ID is set on MATLAB and the cloud server before launching any ROS 2 nodes.
In cloud environments, DDS multicast is often restricted, so explicit DDS configuration is typically required even if local-network setups work without it.
If the issue persists, I recommend you reach out to MathWorks Technical Support. They will be able to assist you.

Produkte

Version

R2024b

Gefragt:

am 3 Apr. 2026

Beantwortet:

am 15 Apr. 2026 um 5:29

Community Treasure Hunt

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

Start Hunting!