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

9 vues (au cours des 30 derniers jours)
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 commentaires
Soner Ulun
Soner Ulun le 20 Fév 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 le 21 Fév 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?

Connectez-vous pour commenter.

Réponse acceptée

Jaime
Jaime le 24 Fév 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 commentaire
Utayba Mohammad
Utayba Mohammad le 24 Fév 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Services and Actions dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by