Jeeho Won
Jeeho Won

Reputation: 21

ROS2 communication between WSL and rpi

I've set up ROS2 both in WSL (changed from version 2 to 1) and my rpi. I checked both ubuntu are connected to the same network, and I am available to ssh to the rpi without any problem. I also even checked if simple ping to one another works or not, and they ping each other just fine.

The problem is that when I try to create a node from like 'demo_node_cpp talker' and listener examples, they seem to not have communication. I have exported the ROS_DOMAIN_ID into the same ID on both computers, and opened my firewall at the computer. How can I have the two devices talk to each other with ROS2 over network?

I checked any sort of debugging options, and one was suggesting to try 'multicast' (which I know nothing about) and try ros2 multicast send & receive on either sides of the computer. The funny thing is that when I try sending multicast on my computer and receive on the rpi, it works fine and gives 'Received from :: 'Hello World!'' as a verification. However, the other way around, when rpi sends and computer receives, an error comes out, saying that '[Errno 92] Protocol not available' at the end. here is the output:

Traceback (most recent call last):
  File "/opt/ros/foxy/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.9.13', 'console_scripts', 'ros2')()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2multicast/command/multicast.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2multicast/verb/receive.py", line 25, in main
    data, (host, port) = receive()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2multicast/api/__init__.py", line 51, in receive
    s.setsockopt(socket.IPPROTO_IP, socket.IP_DROP_MEMBERSHIP, mreq)
OSError: [Errno 92] Protocol not available

Upvotes: 2

Views: 655

Answers (1)

Lam.Ai
Lam.Ai

Reputation: 1

just need to setup Mirrored mode networking on wsl2 so that Multicast is supported. follow this link for more details : https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking

Upvotes: 0

Related Questions