Skip to content

Running on Ubuntu 22.04 ros2 humble #4

@leoguen

Description

@leoguen

Hi,

here is my experience to get the driver running on Ubuntu 22.04 and the Blueye X3 summarised by my AI and I. Thanks for this repo!

✅ Final Summary: Fixing Sonar-3D-15 ROS Driver on Ubuntu 22.04 + ROS 2 Humble

System Setup

OS: Ubuntu 22.04
ROS 2: Humble Hawksbill
Sonar: Waterlinked Sonar 3D-15

Network:
Sonar IP: 192.168.194.96
Host PC Ethernet IP: 192.168.1.90 & Netmask: 255.255.0.0

Interface: enp0s31f6

Problems Observed

  • The ROS node blocked on:
    data, addr = self.sock.recvfrom(self.BUFFER_SIZE)

  • tcpdump -i any showed no packets, and
    tcpdump -i enp0s31f6 host 224.0.0.96 and port 4747 neither

  • The socket joined multicast with INADDR_ANY, which didn’t bind to the correct NIC.

  • By default, the NIC was not accepting multicast packets.


Fixes Applied

  1. Enable multicast on the NIC ("enp0s31f6" is mine, you can find yours with ifconfig)
    sudo ip link set enp0s31f6 multicast on
    After that tcpdump -i enp0s31f6 host 224.0.0.96 and port 4747 should show packages coming in

  2. Join multicast on the correct IP (host IP, not INADDR_ANY)
    Replaced:
    mreq = struct.pack('4sL', group, socket.INADDR_ANY)
    self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)

    with:
    group = socket.inet_aton(self.MULTICAST_GROUP)
    local_ip = socket.inet_aton("192.168.1.90") # host PC IP
    mreq = struct.pack('4s4s', group, local_ip)
    self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
    self.get_logger().info("Joined multicast 224.0.0.96 on enp0s31f6 (192.168.1.90)")

  3. Prevent blocking on empty reads
    self.sock.setblocking(False)
    try:
    data, addr = self.sock.recvfrom(self.BUFFER_SIZE)
    except BlockingIOError:
    return


Verification

  • tcpdump -i enp0s31f6 host 224.0.0.96 and port 4747 shows steady UDP packets.
  • ROS topics /sonar_point_cloud and /sonar_range_image now receive data.

Results

  • Node now correctly receives multicast packets.
  • recvfrom() no longer blocks.
  • Sonar data is visible on ROS 2 topics and can be displayed in RViz once the Fixed Frame is set appropriately (so

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions