ROS connevity with MATLAB on Window and Docker for window

asked 2017-08-01 23:54:00 -0500

ntmilkt gravatar image

I am trying to set development environment for ROS Kinetic using Docker and MATLAB.

Host OS is Windows 10 that include MATLAB robotics system toolbox for ROS. Docker4Windows is installed on Windows 10 with ROS:Kinetic.

Window10(ML:10.0.75.1) - Docker(Hyper-V:10.0.75.2) - Containers(Master, Listener and Talker under bridge network, 172.18.0.X)

I followed up tutorials to communicate container. But I couldn`t reach to communicate with Host. MATLAB can see the topic list. But receiving message is not worked. I searched a lot of page and did many approaches include dns, resolvable and other network mode. Final target is send/receive ROS message between MATLAB on window and containers.

Do you have any idea? or solution?

Below github based modifications are what I have tried last few weeks https://gist.github.com/ruffsl/4a24c2...

edit retag flag offensive close merge delete

Comments

How is the network for the Linux VM and hypervisor, that is running the docker daemon, bridged to the network interface of the windows host machine. This sounds like a VM networking issue, or deficient config. By the way, how does the matlab client know its host IP when connecting to the rosmaster?

ruffsl gravatar image ruffsl  ( 2017-08-07 17:52:02 -0500 )edit

I coulnd`t find right approach. But initializing ros in MATLAB using URI:10.0.75.2 make ros connectivity.

Do you have any idea include network configuration and settings?

ntmilkt gravatar image ntmilkt  ( 2017-08-08 02:01:40 -0500 )edit

Well, if you can do the equivalent of 'rostopic list' in matlab, then matlab sure can reach the ros master, but if matlab can't subscribe to containered nodes, or they can't subscribe to matlab's topics, it seems like an asymmetry in connectivity. Debug w/ netcat http://wiki.ros.org/ROS/NetworkSetup

ruffsl gravatar image ruffsl  ( 2017-08-08 17:17:46 -0500 )edit

Was there ever a solution to this? I am having the same issue I think. I have a Windows 10 host running MATLAB, and a Docker container running ROS. I am able to see the output from rostopic list in MATLAB, however cannot receive data. I've tried several network configurations, but no luck.

patnolan33 gravatar image patnolan33  ( 2018-08-06 09:28:41 -0500 )edit

I've been playing around with this setup for the last couple of years. Here are two approaches I've tried that still work (some older ones broke after updates to Docker).

(1) If using ROS Toolbox 1.2 or later (R2020b). Set the ROS_HOSTNAME of the master running in the container to the internal Docker IP (usually 172.17.0.2). Also, forward the ports for the ROS master and a range of ports to use for ROS subscribers and publishers (I use 700 ports in the starting from port 32,001 or thereabouts). When you launch the container make sure to restrict the ephemeral port range to this range. On the Windows side, add an alias from localhost to 172.17.0.2 using netsh (see this post https://superuser.com/questions/36303...). When you run rosinit on the MATLAB side make sure to set 'nodehost' to host ...(more)

pruvolo gravatar image pruvolo  ( 2020-12-23 21:41:39 -0500 )edit