ROS2 cannot connect to external devices

5 visualizzazioni (ultimi 30 giorni)
敬吾
敬吾 il 21 Ott 2025 alle 12:45
Risposto: Tohru Kikawada circa 5 ore fa
I encountered some issues while communicating with Ubuntu 22.04 via ROS2 using MATLAB 2022b. When I create a new node in Matlab, node=ros2node ('/matlab_node'); I can see this node in Ubuntu, but the node I created in Ubuntu cannot be received by Matlab. Matlab can only display the node '/matlab_node' that I created. What is the reason for this?

Risposte (1)

Tohru Kikawada
Tohru Kikawada circa 4 ore fa
To establish communication between ROS 2 and MATLAB R2022b, please ensure that you're using a ROS 2 distribution supported by MATLAB R2022b. Specifically:
  • MATLAB R2022b supports ROS 2 Foxy, while
  • Ubuntu 22.04 typically comes with ROS 2 Humble, which is not officially supported in R2022b.
You can find the list of supported ROS 2 versions for each MATLAB release at the following link:
Since ROS 2 uses DDS for node discovery and topic exchange, it's important to ensure that the DDS settings are correctly configured. Misconfigured DDS can lead to issues where nodes are not visible across systems.
Please refer to the following guide for configuring ROS 2 nodes and DDS settings in MATLAB:
This behavior is likely due to DDS incompatibility or misconfiguration between MATLAB and the ROS 2 installation on Ubuntu. Even though the node from MATLAB is visible in Ubuntu, the reverse may fail if:
  • The ROS 2 versions are mismatched (e.g., MATLAB using Foxy, Ubuntu using Humble).
  • The DDS implementations or configurations differ (e.g., Fast DDS vs Cyclone DDS).
  • The network settings or domain IDs are not aligned.
To resolve this, I recommend:
  1. Using ROS 2 Foxy on Ubuntu 20.04, which is fully compatible with MATLAB R2022b.
  2. Verifying DDS settings, especially the domain ID and middleware configuration. Or try other DDS implementations.
  3. Checking firewall or network restrictions that may block discovery.
I hope this information helps.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by