I was trying to use Robotics System Toolbox(MATLAB 2015a on windows 7) to communicate with the ROS running on Ubuntu 14.04. The "rosinit" was successful and MATLAB can see the rosnode list, rostopic list, etc. I can also create the rossubscriber from MATLAB to any topic successfully. But when I run "receive" command, it just wait forever until timeout. It seems no new message is coming which should not be the case (as I am sure the ROS on Ubuntu is constantly publishing the new kinect images). I have tried several different settings for rosinit, such as using ROS_MASTER_URI, ROS_IP, etc. Also the two PCs can ping each other's IP successfully. So I think the network connection between the two machines should be good. But MATLAB still couldn't receive the message although it can see and subscribe the topic. Could anyone suggest any possible cause for this issue? Your help would be really appreciated!
Kshitij Singh answered .
2025-11-20
sudo gedit ~/.bashrc
Add the following lines in .bashrc file, save and then restart terminal
export ROS_MASTER_URI=http://Ubuntu_PC_IP:11311 export ROS_IP=Ubuntu_PC_IP
6. On Windows MATLAB, set the environment variables for ROS:
setenv('ROS_MASTER_URI','http://Ubuntu_PC_IP:11311')
setenv('ROS_IP','Windows_PC_IP')
rosinit
Then it should work. I did almost everything except Step 2, which caused the above problem. I hope this would help someone who has the similar problem.