Hello all,
I'm trying to simply publish or subscribe to data using the ROS toolbox in Matlab (my ROS2 version is Humble), but am unable to do so. I have set up two python scripts, one a publisher and one a subscriber, to simply send each other data, and it works perfectly. I have been trying for the past 4 hours to have a Matlab subscriber and a python publisher or a python subscriber and a Matlab publisher, but neither result has worked.
setenv('ROS_DOMAIN_ID', '49');
setenv('ROS_IP', '10.239.18.116')
node = ros2node("/matlab_pub_node", 49);
pub = ros2publisher(node, "/my_topic", "std_msgs/String", ...
"Reliability", "reliable", ...
"Durability", "volatile", ...
"History", "keeplast", ...
disp("Publishing every 5 seconds...");
msg.data = ['Hello from MATLAB at ', datestr(now)];
disp(['Sent: ', msg.data]);
I am running this in Matlab 2025a, and then, in a terminal in Ubuntu 22.04, am running
ros2 topic echo /my_topic
The topic will connect, but no data is said to be received. A very similar result happens when I attempt to publish data from a terminal and subscribe to it in Matlab.
As you can see, I have covered several bases; Domain ID, IP, QoS, and have been unsuccessful. I have also ensured both terminal and Matlab are using rmw_fastrtps_cpp DDS. This has also failed. I am unsure what to try at this point. Some guidance would be greatly appreciated.