ROS subscriber callback is not triggered when the master is run from ros hydro
8 views (last 30 days)
Show older comments
Utayba Mohammad
on 10 Feb 2014
Commented: Utayba Mohammad
on 24 Feb 2014
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
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
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?
Accepted Answer
Jaime
on 24 Feb 2014
here it is the link : http://answers.ros.org/question/130356/how-to-subscribe-to-topics-using-ros-support-from-matlab/?answer=132381#post-id-132381
I hope it will work for you as well.
Greets, Jaime
More Answers (0)
See Also
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!