ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

How to subscribe to topics using ROS Support from MATLAB? [closed]

asked 2014-02-18 00:10:02 -0500

Dear all,

I am testing the new ROS support from Matlab. I have the provided examples working without problems. Actually, the examples show how the subscribers work with messages published by the same matlab node (It also worked for me), but when I try to subscribe the matlab node to a topic from a c++ node, the Matlab code never calls the handle function though I see in rqt_graph the connection established.

You can reproduce this issue by using the basic_example in the previously posted link and changing the topic_name and topic_type in the subscriber definition to subscribe to an "external" node.

Please, does anyone found problems with this new and promising tool?

Thanks in advance.

Àngel.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Àngel - IRI
close date 2014-04-18 00:04:06

2 Answers

Sort by » oldest newest most voted
3

answered 2014-02-23 21:08:32 -0500

jaimerv gravatar image

updated 2014-02-23 22:47:20 -0500

Hi Angel, i am dealing with the same problem. Apparently the communication between MATLAB and ROS is unidirectional http://www.mathworks.fr/matlabcentral... so MATLAB can communicate with ROS, but not the other way around. i am looking for some solutions, and so far i have found this https://alliance.seas.upenn.edu/~meam... but not sure if it will work,

Let me know if you find a proper solution, greets, Jaime

UPDATED: okey i found the solution. There is a difference when you lauch the roscore from terminal and when you do it from MATLAB. Following the next steps worked for me:

1) edit your .bashrc and add these lines:

export ROS_HOSTNAME=localhost

export ROS_MASTER_URI=http://localhost:11311

2) from terminal : roscore

3) now try again the communication with the subscriber from MATLAB. It should now work.

Greets, Jaime

edit flag offensive delete link more
2

answered 2014-04-15 19:49:16 -0500

jcgarcia gravatar image

It's basically a bad setup regarding the IP's. See Mathworks support: http://www.mathworks.com/matlabcentra...

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2014-02-18 00:10:02 -0500

Seen: 3,410 times

Last updated: Apr 15 '14