mje-nz / natnet_ros

NatNet 3 ROS driver
BSD 3-Clause "New" or "Revised" License
19 stars 9 forks source link

Troubleshooting Windows-Ubuntu NatNet connections #7

Open felixvd opened 5 years ago

felixvd commented 5 years ago

This is not a bug report, but we are having some issues setting up our network to use this package. Since you probably have some experience, I'd be glad if you could weigh in on where the error might lie. I wouldn't mind summarizing later for a troubleshooting guide in the Readme.

We have a Windows laptop running Motive 2 and a PC running Ubuntu 18.04 with ROS Melodic connected to a local network, and the natnet_ros on the dev branch. The Windows laptop is streaming via the NatNetSDK sample code. There should be no firewalls active. When we

If we start up the natnet_ros client with the IP of the windows machine, we get a socket error:

~/catkin_ws$ rosrun natnet_ros client _server:=192.168.0.10
[INFO] [1565177910.888035]: Connecting to 192.168.0.10
Traceback (most recent call last):
  File "/home/omron/catkin_ws/src/natnet_ros/natnet_ros/scripts/client", line 290, in <module>
    node.run()
  File "/home/omron/catkin_ws/src/natnet_ros/natnet_ros/scripts/client", line 280, in run
    client = natnet.Client.connect(server, logger=self.log)
  File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 437, in connect
    return cls._simple_connect(server, logger, timeout)
  File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 420, in _simple_connect
    return cls._setup_client(conn, server_info, logger)
  File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 354, in _setup_client
    server_info.connection_info.data_port)
  File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 61, in bind_data_socket
    self._data_socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 19] No such device

Connecting to the multicast_IP gives Errno 101: Network is unreachable. I am not knowledgeable enough about sockets to fix this, so if you have any pointers we'd be grateful.

@asmidgard

mje-nz commented 5 years ago

That setup should work, that’s pretty much what we do. Can you ping the Windows machine from the Ubuntu machine? Could you please post a screenshot of your streaming settings in Motive? Assuming you’re using multicast streaming, what happens if you run the natnet_ros client without specifying the server and let it autodiscover?

asmidgard commented 5 years ago

@mje-nz
felixvd is our project member, so I reply to you.

First, we can ping Windows and Ubuntu machine from each machine.

Motive streaming setting is below. image

And when I run the natnet_ros client without specifying the server, Ubuntu can't discover, a message is "Network is unreachable".

Did you change the setting of firewall?

mje-nz commented 5 years ago

It sounds like either your Ubuntu PC or your network has a problem with multicast networking. How are the two computers connected? Could you post the output of ifconfig and netstat -nr?

asmidgard commented 5 years ago

@mje-nz Thank you for your quick reply.

We connected two pc using a network switching hub. The hub is below. https://www.tp-link.com/us/business-networking/unmanaged-switch/tl-sg1008p/

netstat -nr result

xxxx@learning5:~/catkin_ws$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp4s0
172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 enp4s0

ifconfg result

omron@learning5:~/catkin_ws$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
       ether 02:42:be:d2:d1:d7  txqueuelen 0  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.0.11  netmask 255.255.255.0  broadcast 192.168.0.255
       inet6 fe80::16b3:1fff:fe06:cfc1  prefixlen 64  scopeid 0x20<link>
       ether 14:b3:1f:06:cf:c1  txqueuelen 1000  (Ethernet)
       RX packets 328  bytes 32317 (32.3 KB)
       RX errors 0  dropped 21  overruns 0  frame 0
       TX packets 165  bytes 15231 (15.2 KB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device interrupt 19
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10<host>
       loop  txqueuelen 1000  (Local Loopback)
       RX packets 17788  bytes 1174806 (1.1 MB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 17788  bytes 1174806 (1.1 MB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
mje-nz commented 5 years ago

That's odd, try route add -net 224.0.0.0 netmask 240.0.0.0 enp4s0?

asmidgard commented 5 years ago

@mje-nz Thank you for your advice. I tried "sudo route add -net 224.0.0.0 netmask 240.0.0.0 enp4s0"

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp4s0
172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 enp4s0
224.0.0.0       0.0.0.0         240.0.0.0       U         0 0          0 enp4s0

But it still occurs the same error ;(

omron@learning5:~/catkin_ws$ rosrun natnet_ros client
[INFO] [1565250850.185011]: Discovering servers
Traceback (most recent call last):
 File "/home/omron/catkin_ws/src/natnet_ros/natnet_ros/scripts/client", line 290, in <module>
   node.run()
 File "/home/omron/catkin_ws/src/natnet_ros/natnet_ros/scripts/client", line 280, in run
   client = natnet.Client.connect(server, logger=self.log)
 File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 435, in connect
   return cls._discover_and_connect(logger, timeout)
 File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 373, in _discover_and_connect
   conn.send_message(protocol.DiscoveryMessage())
 File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 162, in send_message
   self.send_packet(protocol.serialize(message))
 File "/home/omron/catkin_ws/src/natnet_ros/python_natnet/python_natnet/src/natnet/comms.py", line 159, in send_packet
   self._command_socket.sendto(packet, self._command_address)
socket.error: [Errno 101] Network is unreachable
mje-nz commented 5 years ago

This is a bit beyond me I'm afraid, we have about a dozen different computers with different Linux versions and network configurations and I've never seen either of your problems. It's hard to debug a problem I can't reproduce!

Can you try with a different client PC or a different network?

Try testing multicast like this?

asmidgard commented 5 years ago

Thank you for useful suggestion @mje-nz

It did works on another PC, after I added route that you tell me.

machine information OS: Ubuntu 16.04 ROS: Kinetic Wifi:Disable

msi_setting

I cannot thank you enough. I'd say you really saved my life.

mje-nz commented 5 years ago

No worries, glad I could help! Did you ever figure out what was wrong on the first machine?

asmidgard commented 5 years ago

@mje-nz No, I can't resolve on our first machine :<

aarsht7 commented 2 years ago

I had same issue. Disabling the firewall on the windows PC helped to solve it.