ROS subscriber callback is not triggered when the master is run from ros hydro
Show older comments
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
Felix Burget
on 10 Feb 2014
Hi Utayba,
i am having the same problem. Just trying so use Matlab to plot some data in real time while running a ROS application. I already tried to receive messages in matlab using
rostopic pub /TOPIC std_msgs/String 'Hello'
without success. The communication between ROS & Matlab does not seem to be bidirectional. There's also no example or tutorial explaining how messages published from ROS are received by a Matlab subscriber. Hope to get some info soon.
Best, Felix
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
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!