ros2_ouster_drivers icon indicating copy to clipboard operation
ros2_ouster_drivers copied to clipboard

Disabled IPv6 - Failed to send lidar UDP data to destination host

Open Sollimann opened this issue 2 years ago • 1 comments

In case you're getting this kind of error from the Lidar (OS0-128 in my case), I thought I should share a fix:

image

It could be that you're computer has IPv6 disabled by default. In my case the Intel NuC on the Clearpath Jackal has disabled IPv6 in the GRUB bootloaderen: /etc/default/grub. To fix the issue you can either enable IPv6 or your can make changes to the drivers client.cpp file. I did the latter:

  1. change hints.ai_family to AF_INET (line 77 ish) client.cpp
  memset(&hints, 0, sizeof hints);
  // hints.ai_family = AF_INET6;
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_flags = AI_PASSIVE;
  1. comment out the following (ish line 103 - 112) client.cpp
  // int off = 0;
  // if (setsockopt(
  //     sock_fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&off,
  //     sizeof(off)))
  // {
  //   std::cerr << "udp setsockopt(): " << impl::socket_get_error() <<
  //     std::endl;
  //   impl::socket_close(sock_fd);
  //   return SOCKET_ERROR;
  // }

related issue: https://github.com/ouster-lidar/ouster_example/issues/185

Sollimann avatar Feb 10 '22 09:02 Sollimann

hi, where is cpp files? I couldnt find it in drivers folder? @Sollimann

zehranrgi avatar Aug 05 '23 06:08 zehranrgi