connecting matlab and ros in same computer
hi every one.I'm so begginer with ros and I want to run talker.m in matlab and visulize it's results in ros (in linux terminal).but I can't connect matlab to ros.I use ubuntu 16.04 and ros kinetic version.I set ros_ip=my_pc_name:11311 and my matlab ip as my pc ip using 'ifconfig'.In this code matlab gets this error: Error using talker (line 12) Cannot determine the message type of the /talker topic. Either the topic is not registered with the ROS master, or the ROS master is not reachable.
////////////////////////////////////matlab code
rosshutdown
ros_master_ip = 'http://localhost:11311';
matlab_ip = '192.168.42.10';
rosinit(ros_master_ip,'NodeHost',matlab_ip);
talker_sub = rossubscriber( '/talker' );
[chatter_pub, chatter_msg] = rospublisher('/chatter','std_msgs/String');
r = rosrate(2); % 2 Hz loop rate
pause(2) % wait a bit the roscore initialization
Hi @m.kowsar,
I think the problem is you are subscribing to an nonexistent topic. The standard information flow will be:
To communicate both ends.
thanks a lot @Weasfas for your answer.it seems to be right.