R2015a Robotics System Toolbox: Cannot subscribe to topics on Windows MATLAB node

4 views (last 30 days)
I have my roscore running on my Ubuntu machine which is running the Gazebo simulator. I configured the MATLAB node with the ROS_MASTER_URI environment variable and I can see the topics generated from the simulator using 'rostopic list' however I cannot subscribe or echo any of the topics on MATLAB. How do I fix this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 9 Jun 2015
Please add the host name and IP address of your Ubuntu machine to the 'C:\Windows\System32\drivers\etc\hosts' file. In the 'hosts' file add the IP address and host name as shown below.
For example, <Linux Host Name>
To initialize the MATLAB rosnode, please run the following commands when connecting to the network:
>>rosinit('<Linux Host Name', 'NodeHost', '<Windows Host Name>')
You should then be able to subscribe and echo topics that are published over the network.

More Answers (1)

Mark Levin
Mark Levin on 16 Dec 2015
Hi! I have the same problem - I use Clearpath Jackal robot as a ros master and I try to connect with Robotics Toolbox of Matlab 2015a. I have no problem to publish, it means, robot moves as I want, but every time I do subscribe I get the same answer, that the time is gone and no message was gotten. In summary, - I can see the rostopic list - I can control the robot by publishing - I can't get messages. What can I do? I tried to update hosts file - I added the robot's IP and put some name (does it matter what name do I use?) and then even publishing doesn't work. Thank in advance!
sam on 22 Oct 2021
Edited: MathWorks Support Team on 28 Sep 2022
I had the same issue with the Clearpath Jackal but the issue was resolved after following along with wjchen84's solution in https://www.mathworks.com/matlabcentral/answers/196911-use-matlab-robotics-system-toolbox-to-receive-ros-message. For me that meant only updating the 'hosts' file on both the Jackal and the external computer running MATLAB/Simulink.

Sign in to comment.


Find more on ROS Log Files and Transformations in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!