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

8 views (last 30 days)
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');
  3 Comments
Soner Ulun
Soner Ulun on 20 Feb 2014
Hi,
Were you able to run any of the examples? When I try rosmatlab_basic I receive the following error:
>> rosmatlab_basic
Undefined variable "org" or class "org.ros.RosCore.newPublic".
Error in rosmatlab.roscore (line 62)
rosMaster = org.ros.RosCore.newPublic(port);
Error in rosmatlab_basic (line 4)
roscore = rosmatlab.roscore(11311);
Do i need to install any other packages for Hydro? I just download and installed the source from matlab. There is no tutorial or proper instructions for this package, so any help is apriciated.
Bests,
Soner
Daniel
Daniel on 21 Feb 2014
I have the same problem in hydro. I have try with many official and unofficial messages, but communication is only works from Matlab to ROS. However when nodes are create with Matlab communication is bidirectional.
Soner Ulun: Are you in the correct path?

Sign in to comment.

Accepted Answer

Jaime
Jaime on 24 Feb 2014
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
  1 Comment
Utayba Mohammad
Utayba Mohammad on 24 Feb 2014
Thanks Jaime,
That worked for me. Following up on your solution I notice that when you don't specify ROS_MASTER_URI, roscore uses a default value of "http://ubuntu:11311" so Matlab was communicating with ROS properly using localhost or explicit IP but not the other way around.

Sign in to comment.

More Answers (0)

Categories

Find more on Services and Actions 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!