MATLAB Answers

0

External ROS node can't communicate with simulink

Mark Duntz 님이 질문을 제출함. 13 Aug 2019
최근 활동 Ines Vujkovac 님이 답변함. 8 Oct 2019 8:29
I am trying to implement the simulink drone controller simulation with Gazebo shown in the Mathworks webinar "MATLAB and Simulink Robotics Arena: Simulating Quadcopter Missions"
I am able to get everything setup, but when I run the simulink controller, it does not affect the Gazebo simulation. Both ROS nodes are detecting each other, and the topics are running correctly. I have traced the problem to the communication between the Simulink controller and the Gazebo sim. Simulink is publishing messages but the Gazebo sim is not receiving them.
Does this have something to do wih the node IPs? I have tried all combinations I can think of.
When I execute rosnode info <simulink node>, I receive the communication error "ERROR: Communication with node[http:192.168.122.1:40426/] failed!"
Any ideas? Thanks

  댓글 수: 0

로그인 to comment.

태그

답변 수: 2

Cam Salzberger 님의 답변 14 Aug 2019

Hey Mark,
I usually see this kind of issue going the other way (external nodes unable to send data to MATLAB/Simulink), but it's possible to happen the other direction as well. Try setting the ROS_IP environment variable on both sides of things (set to the IP address of the machine it is on). It needs to be set in MATLAB as well as in each terminal that runs any ROS nodes on the external machine. Then restart all the ROS nodes.
Also make sure that ROS_HOSTNAME is not set if trying ROS_IP. This helps to ensure that the IP address of the node is advertised correctly so that point-to-point communication between nodes is possible.
If that doesn't resolve the issue, here are some further steps:
  1. Can you check if you can do "rosnode ping <simulink node>" from the remote machine. If not, it may be a DNS resolution issue.
  2. See if you can publish messages from MATLAB to the remote machine, to see if it's just a simulink issue.
  3. Try a different message type (one of the std_msgs). It may be possible (though not likely) that there is some kind of message type difference that is causing ROS to drop the messages due to mismatched md5 checksums. This usually gives an error, but maybe Gazebo is silently catching it? If you need to update your built-in message types, here are the instructions.
-Cam

  댓글 수: 1

Hi Cam,
Thank you for the help. I have the ROS_IPs set on both machines. The "rosnode ping <simulink node>" fails from the virtual machine. It says it is pinging with a 3sec timeout but immediately returns with a timeout message (definitely not 3sec).
I tried "rosnode('ping','/gazebo')" from MATLAB and it worked. Are you able to elaborate a little bit more on "DNS resolution issue"?
For the record, the normal terminal "ping <local host ROS_IP>" command works fine from the VM.
Thanks again for the help
-Mark

로그인 to comment.


Ines Vujkovac 님의 답변 8 Oct 2019 8:29

Hey Mark,
I realize this is already becoming an older post, and I hope you were able to resolve your issue, but just for anybody who is looking into it, it should just be a matter of allowing inbound rules for Matlab specifically. Even though your computer is allowing inbound connection, make sure Matlab isn't being blocked. All the needed settigns are in Advanced Settings for Firewall (I assume you are using WIndows)

  댓글 수: 0

로그인 to comment.



Translated by