ros-drivers / velodyne

ROS support for Velodyne 3D LIDARs
http://ros.org/wiki/velodyne
Other
657 stars 652 forks source link

Velodyne vlp-16 not publishing Pointcloud2 with ROS2 in Docker (ROS1 working) #540

Open h0uter opened 3 months ago

h0uter commented 3 months ago

Please complete the following information:

Describe the bug ROS2 driver boots, creates topics but never publishes on those topics

bootlog

velodyne-1  | [INFO] [launch]: All log files can be found below /root/.ros/log/XXXX
velodyne-1  | [INFO] [launch]: Default logging verbosity is set to INFO
velodyne-1  | [INFO] [velodyne_driver_node-1]: process started with pid [30]
velodyne-1  | [INFO] [velodyne_convert_node-2]: process started with pid [32]
velodyne-1  | [INFO] [velodyne_laserscan_node-3]: process started with pid [34]
velodyne-1  | [velodyne_driver_node-1] [INFO] [1723573645.668104927] [velodyne_driver_node]: Velodyne VLP-16 rotating at 600.000000 RPM
velodyne-1  | [velodyne_driver_node-1] [INFO] [1723573645.668337121] [velodyne_driver_node]: publishing 76 packets per scan
velodyne-1  | [velodyne_driver_node-1] [INFO] [1723573645.668374369] [velodyne_driver_node]: Cut at specific angle feature activated. Cutting velodyne points always at 6.283185 rad.
velodyne-1  | [velodyne_driver_node-1] [INFO] [1723573645.668388673] [velodyne_driver_node]: expected frequency: 9.921 (Hz)
velodyne-1  | [velodyne_driver_node-1] [INFO] [1723573645.669490764] [velodyne_driver_node]: Only accepting packets from IP address: 192.168.1.201
velodyne-1  | [velodyne_driver_node-1] [INFO] [1723573645.669550317] [velodyne_driver_node]: Opening UDP socket: port 2368
velodyne-1  | [velodyne_convert_node-2] [INFO] [1723573645.670721400] [velodyne_convert_node]: correction angles: /opt/ros/foxy/share/velodyne_pointcloud/params/VLP16db.yaml

To Reproduce The following Dockerfile builds successfully, it starts successfully, it mentions the cannot poll() error when I power down the Velodyne, it successfully creates the topic /velodyne_pointclouds. However it does not publish any messages on this topic.

# ROS2 Dockerfile
ARG ROS_DISTRO=humble

FROM ros:$ROS_DISTRO
ENV ROS_DISTRO=$ROS_DISTRO

RUN apt-get update && apt-get upgrade -y

RUN apt-get update \
    && apt-get install -y curl \
    && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - \
    && apt-get update

# install the velodyne drivers
RUN apt-get install -y ros-$ROS_DISTRO-velodyne

CMD  "ros2 launch velodyne velodyne-all-nodes-VLP16-launch.py"

Expected behavior I expect Pointcloud2 messages to be published on the /velodyne_pointclouds topic.

Additional context Everything is working fine under ROS1 with the following Dockerfile:

# ROS1 Dockerfile
ARG ROS_DISTRO=noetic

FROM ros:$ROS_DISTRO-ros-core AS base

ENV ROS_DISTRO=$ROS_DISTRO

# set shell to bash (instead of "sh") for RUN (first line) and when opening a new terminal (second line).
SHELL ["/bin/bash", "-c"]
ENV SHELL /bin/bash

RUN apt-get update && apt-get upgrade -y

RUN apt-get update \
    && apt-get install -y curl \
    && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - \
    && apt-get update \
    && apt-get install -y ros-$ROS_DISTRO-velodyne-pointcloud\
    # && rosdep install --from-paths /ws_production/src -i -r -y\
    && rm -rf /var/lib/apt/lists/*

CMD "roslaunch velodyne_pointcloud VLP16_points.launch --wait"
g1y5x3 commented 1 month ago

It worked for me with ROS2, I can visualize the /velodyne_points topic through rviz2. I installed from source using colcon from the humble-devel branch.