MATLAB Answers

Issue publishing ROS messages to another machine.

24 views (last 30 days)
Patrick B
Patrick B on 2 Mar 2019
Commented: Patrick B on 25 Mar 2021
Whenever I run rosinit(<IP ADDRESS>) to connect to another machine running ros, my computer has issues communicating to the other machine. My matlab can receive rosmessages from the other machine, but it can't send them. When I try to publish messages, the other machine can see that the topics are being published to, but when I try to rostopic echo them, nothing pops up.
Additionally, when I run rqt_graph on the other machine, I can see the global node matlab publishes as "n__matlab_global_node_36579". I can see that this node is publishing/subscribing to the appropriate topics, but I still can't see any of the messages.
I've managed to make this connection before on other machines, and when I run rqt_graph they get displayed as "/matlab_global_node_16900". I'm wonding if it's the matlab global node declaration that's having an issue? There wasn't really any difference between the two machines running matlab in terms of setup for rosinit. They both ran the same command (rosinit(<IP>))
I'm using the Robotics Sytem Toolbox, running Matlab 2018b
  4 Comments
Patrick B
Patrick B on 4 Mar 2019
Turns out we didn't turn off the firewall completely. Anyways, I fixed it by adding a new outbound rule that allowed MATLAB to send data. I'll copy this as the solution below. Thanks @walter roberson

Sign in to comment.

Accepted Answer

Patrick B
Patrick B on 4 Mar 2019
Turns out it was a firewall issue. I added a new outbound rule to my firewall allowing MATLAB 2018b to communicate and that fixed my issue. Shout out to Walter Roberson for pointing that out!
  2 Comments
Patrick B
Patrick B on 25 Mar 2021
Oh wow this was 2 years ago now, I'll try. I was running on Windows so I had to add a rule to Windows Defender Firewall.
Pretty sure these were the steps I followed: in Windows Defender Firewall settings in Control Panel, click "Advanced Settings," then in the new window that opens click "Outbound Rules" in the left tab. Click "New Rule..." in the right tab. Here's how I filled out my rule:
with the program being the path to the matlab .exe file
And then all other tabs I left as default/blank.
Hope that helps!
You might also just be able to click "Allow an app or feature through Windows Defender Firewall" in Control Panel, and then "allow another app" with the path to the executable (or alternatively make sure Matlab 20xx is enabled).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!