Ask Your Question
1

ROS Matlab I/O Subscribers don't work

asked 2014-04-20 04:53:31 -0500

Jari gravatar image

updated 2016-10-24 09:09:59 -0500

ngrennan gravatar image

Hi All,

I'm trying to use the ROS-Matlab I/O package to publish and subscribe to topics from a roscore on a networked machine. I have gone through the network setup, and this is the current state of the whole system:

Machine A (running ROS)

The /etc/hosts file lists 127.0.0.1 localhost 127.0.1.1 The-Master 192.168.2.7 The-Doctor

The relevant (as far as I know) environment variables are:

$ROS_MASTER_URI=http://The-Master:11311/

$ROS_HOSTNAME=The-Master

Machine B (running Matlab)

The /etc/hosts file lists

127.0.0.1 localhost

127.0.1.1 The-Doctor

192.168.2.3 The-Master

The relevant environment variables are:

$ROS_MASTER_URI=http://The-Master:11311/

$ROS_HOSTNAME=The-Doctor

.

.

I can ping the between the two machines, both by IP and by name. I can netcat between both of them just fine. Using rosmatlab, I can create a node on The-Doctor which is seen by The-Master. I can create a publisher which is also seen by The-Master. The-Doctor can publish data to The-Master and it shows up just fine when I do a "rostopic echo" on The-Master.

The problem is: when The-Doctor tries to subscribe to a topic from The-Master, the callback function defined in the Matlab code never gets called. Just to make sure that I wasn't making any major mistakes, I ran the rosmatlab_basic.m example included with ROS-Matlab I/O, and the subscribers in that example don't work either (even though the publishers do).

Any idea on what might be wrong? I'm running Matlab R2013b, but I have tested this with multiple versions, both Windows and Ubuntu. I see the same problem which leads me to believe that somewhere along the line I'm doing something wrong in the network setup and am too dumb to know what.

Please help :\

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2014-04-21 23:58:32 -0500

redsuncheng gravatar image

I found the solution here. http://www.mathworks.com/matlabcentra...

Configure the two hosts precisely according to the instructions and it works for me.

edit flag offensive delete link more

Comments

It works. The subscribers can see the data now. What I don't understand is why my setup wasn't working. From all indications I did not have any name resolution problems. Interestingly enough, when I go back to the named approach now, Matlab throws an error whenever data is available for a subscriber

Jari gravatar imageJari ( 2014-04-22 01:54:08 -0500 )edit

hello! I want to realize the communication between turtlebot and MATLAB,but i do not know where to download ros-matlab.Can you tell me where i can download it?thank you very much!

Jie Sky gravatar imageJie Sky ( 2014-12-13 01:08:05 -0500 )edit
-1

answered 2014-04-21 04:22:36 -0500

redsuncheng gravatar image

I am experiencing the very same issues. Using Matlab R2012b as the slave and Ubuntu ROS as the master. Tha Matlab Slave can publish message to the master, However, the message from master can never reach the Matlab node.

Waiting for the answer!!

Up

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-04-20 04:53:31 -0500

Seen: 1,618 times

Last updated: Apr 21 '14