Receive message from ROS to Matlab robotics toolbox
Show older comments
Good morning everyone,
I am getting started with ros using matlab. I use a macbook which i installed matlab in, and i simultaneously use a Vm runnning on my mac as a second machine.
I am using Vmware fusion in which i installed Ubuntu and ROS on it. Gazebo is installed and i am using turtlebot3 package and wanted to receive data from the /scan topic after launching gazebo with this command "roslaunch turtlebot3_gazebo turtlebot3_world.launch".
After using the rosinit command on matlab side, the connection seems to be working pretty much fine. Here is the basic matlab code i am using :
scanSub = rossubscriber('/scan')
laserMsg = receive(scanSub,2);
i get this message error : Error using ros.Subscriber/receive (line 294)
The function did not receive any data and timed out.
Error in test (line 4)
laserMsg = receive(scanSub,2);
also, by using the command "rostopic echo scan" i was able to see that messages were indeed published by the scan topic.
When i used the command "rostopic info /scan" i saw also that "/matlab_global_node_46314 (http://172.16.115.1:52998/)" was a suscriber of the scan topic
Moreover, i also tried to ad those lines "export ROS_MASTER_URI=http//192.168.1.28:11311" and "export ROS_HOSTNAME=192.168.1.28" on my bashrc. but as soon as i had them i get this error message while trying to luch gazebo or even roscore commands i get this error as well : "RLEception : Unable to contact my own server at [http://192.168.0103:41401/].
This usually means that the network is not configured properly.
a common cause is that the machine cannot ping itslef. please check ofr errors by running :
ping 192.168.0.103
for more tips, please use
the traceback for the execption was written to the log file
Accepted Answer
More Answers (0)
Categories
Find more on Network Connection and Exploration 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!