MATLAB: ROS subscriber callback is not triggered when the master is run from ros hydro

matlab subscriberros hydro

I have the following setup in Linux: 1- ros core (hydro) running on a separate terminal. 2- stage publish LIDAR message and others… 3- Matlab subscribing to Lidar messages and displaying a message every time a message is received.
Verified: 1- rostopic list shows the Lidar data is publish at an average 10 Hz rate 2- Matlab node is recognized by ros as a subscriber to the Lidar topic (/base_scan)
Problem: The call back function never gets triggered.
Note: I tried a similar setup with roscore running on Matlab with publisher & subscriber to Lidar data, and that worked…
code:
node = rosmatlab.node('LidarPlotter', 'http://localhost:11311');
subscriber = rosmatlab.subscriber('/base_scan', 'sensor_msgs/LaserScan', 10, node);
subscriber.setOnNewMessageListeners({@LidarPlot});
pause(10);
node.removeSubscriber(subscriber);
% Delete the master.
clear('roscore');
%%Clean up workspace.
clear;
Function code:
function LidarPlot(x)
disp('a lidar message has been received');

Best Answer

Hi, i found a solution and post it in http://answers.ros.org/questions/
I hope it will work for you as well.
Greets, Jaime