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:
- Using ROS 2 Foxy on Ubuntu 20.04, which is fully compatible with MATLAB R2022b.
- Verifying DDS settings, especially the domain ID and middleware configuration. Or try other DDS implementations.
- Checking firewall or network restrictions that may block discovery.
I hope this information helps.