{"id":21702441,"url":"https://github.com/2b-t/velodyne-ros2-docker","last_synced_at":"2025-04-12T14:50:40.999Z","repository":{"id":178153834,"uuid":"615855680","full_name":"2b-t/velodyne-ros2-docker","owner":"2b-t","description":"Dockerfile for Velodyne VLP-16 and VLP-32 in ROS 2 ","archived":false,"fork":false,"pushed_at":"2024-09-09T20:02:04.000Z","size":413,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T09:21:20.383Z","etag":null,"topics":["3d-lidar","docker","docker-compose","dockerfile","dockerfile-examples","lidar","robot-operating-system","ros2","ros2-humble","velodyne","velodyne-vlp","vlp-16","vlp-32"],"latest_commit_sha":null,"homepage":"","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2b-t.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-18T21:47:37.000Z","updated_at":"2025-02-12T16:19:24.000Z","dependencies_parsed_at":"2023-11-26T18:41:28.850Z","dependency_job_id":null,"html_url":"https://github.com/2b-t/velodyne-ros2-docker","commit_stats":null,"previous_names":["2b-t/velodyne-ros2-docker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2b-t%2Fvelodyne-ros2-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2b-t%2Fvelodyne-ros2-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2b-t%2Fvelodyne-ros2-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2b-t%2Fvelodyne-ros2-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2b-t","download_url":"https://codeload.github.com/2b-t/velodyne-ros2-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586121,"owners_count":21128982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-lidar","docker","docker-compose","dockerfile","dockerfile-examples","lidar","robot-operating-system","ros2","ros2-humble","velodyne","velodyne-vlp","vlp-16","vlp-32"],"created_at":"2024-11-25T21:15:37.197Z","updated_at":"2025-04-12T14:50:40.980Z","avatar_url":"https://github.com/2b-t.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker for Velodyne 3D lidars on ROS 2\n\nAuthor: [Tobit Flatscher](https://github.com/2b-t) (2023)\n\n[![Build](https://github.com/2b-t/velodyne-ros2-docker/actions/workflows/build.yml/badge.svg)](https://github.com/2b-t/velodyne-ros2-docker/actions/workflows/build.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\n\n## 0. Overview\nThis repository contains a Dockerfile and all the documentation required for setting up and launching a [Velodyne 3D lidar](https://velodynelidar.com/surround-lidar/) such as the VLP-16 or VLP-32 with the [Robot Operating System ROS 2](https://docs.ros.org/en/humble/index.html). I have tested this with both VLP-16 and VLP-32 lidars.\n\nThe Velodyne lidars are common in two different versions, with an **interface box** or with an **8-pin M12 connector** (M12MP-A) only. The ones with interface boxes are generally quite expensive on the second-hand market while the ones with M12 connector often go comparably cheap.\n\n| ![Hardware integration with Velodyne LiDAR OLD – OxTS Support](https://support.oxts.com/hc/article_attachments/115006706969/mceclip0.png) | ![Hardware Integration with Velodyne LiDAR – OxTS Support](https://support.oxts.com/hc/article_attachments/360017839699/mceclip0.png) |\n| ------------------------------------------------------------ | ------------------------------------------------------------ |\n| Velodyne VLP-16 with interface box                           | Male 8-pin M12 connector                                     |\n\nThe interface box already comes with an overcurrent protection and gives you access to an Ethernet port as well as a power connector. For the 8-pin power connector on the other hand you will have to create your own cable. This can though be done with comparably little effort (without cutting the cable). In case you bought one without the interface box have a look at the **[cabling guide](./doc/CablingGuide.md) in this repository for information on making your own cable**.\n\n## 1. Configuring\nThe set-up is similar to the Velodyne [VLP-16](http://wiki.ros.org/velodyne/Tutorials/Getting%20Started%20with%20the%20Velodyne%20VLP16) and the [HDL-32E](http://wiki.ros.org/velodyne/Tutorials/Getting%20Started%20with%20the%20HDL-32E) lidar in ROS. As a first step we will have to **find out which network interface our lidar is connected to**. For this launch the following command \n\n```bash\n$ for d in /sys/class/net/*; do echo \"$(basename ${d}): $(cat $d/{carrier,operstate} | tr '\\n' ' ')\"; done\n```\n\nThis will output a list of the available interfaces as well as their connection status:\n\n```bash\nbr-af62670dc1bb: 0 down \nbr-eabc8a210172: 0 down \ndocker0: 0 down \neno1: 0 down \nlo: 1 unknown \nwlx9ca2f491591b: 1 up \n```\n\nNow plug-in the lidar and the corresponding network interface (should start in `en*` due to the [network interface naming convention](https://man7.org/linux/man-pages/man7/systemd.net-naming-scheme.7.html)) should change to `up` when launching the same command again:\n\n```bash\nbr-af62670dc1bb: 0 down \nbr-eabc8a210172: 0 down \ndocker0: 0 down \neno1: 1 up \nlo: 1 unknown \nwlx9ca2f491591b: 1 up \n```\n\nThis network interfaces corresponds to the device with the MAC-address\n\n```bash\n$ cat /sys/class/net/eno1/address\nAB:12:c3:45:67:8a\n```\n\nNow you can [follow the ROS guide to configure your IP address on the host computer](http://wiki.ros.org/velodyne/Tutorials/Getting%20Started%20with%20the%20Velodyne%20VLP16#Configure_your_computer.2BIBk-s_IP_address_through_the_Gnome_interface) for the corresponding network interface (or alternatively follow the [Ubuntu Net Manual](https://help.ubuntu.com/stable/ubuntu-help/net-manual.html.en)) where the configuration is performed via the graphic menu or continue with the following paragraph that performs the same set-up through the command line. Be sure to replace `eno1` with your network interface in the commands below!\n\nLet us check the available connections with `nmcli`:\n\n```bash\n$ nmcli connection show\n```\n\nLet's create a **new connection**, assigning us the IP address `192.168.1.100`. Feel free to replace `100` with any number between `1` and `254` apart from the one the Velodyne is configured to (`201` by default).\n\n```bash\n$ nmcli connection add con-name velodyne-con ifname eno1 type ethernet ip4 192.168.1.100/24\n```\n\nNow let's inspect the connection with:\n\n```bash\n$ nmcli connection show velodyne-con\n```\n\nLet's bring up the connection with the following command:\n\n```bash\n$ nmcli connection up id velodyne-con\n```\n\nLet's show the IP address of our device:\n\n```bash\n$ ip address show dev eno1\n```\n\n**[Temporarily configure yourself an IP address](https://ubuntu.com/server/docs/network-configuration) in the `192.168.3.X` range**:\n\n```bash\n$ sudo ip addr add 192.168.3.100 dev eno1\n```\n\nSet up a **temporary route to the Velodyne**. In case a different address was configured for the Velodyne replace the address below by its address.\n\n```bash\n$ sudo route add 192.168.1.201 dev eno1\n```\n\n```bash\n$ ip route show dev eno1\n```\n\nNow you should be able to open the webpage [http://192.168.1.201](http://192.168.1.201) and change the configuration for your Velodyne if desired/needed.\n\n![Velodyne user interface](./media/velodyne-user-interface.png)\n\nInside your Dockerfile make sure to use the `network_mode` `host` option:\n\n```yaml\n    network_mode: \"host\"\n```\n\n## 2. Launching\nAllow the container to display contents on your host machine by typing\n\n```bash\n$ xhost +local:root\n```\n\nThen build the Docker container with\n\n```shell\n$ docker compose -f docker-compose-gui.yml build\n```\nor directly with the [`devcontainer` in Visual Studio Code](https://code.visualstudio.com/docs/devcontainers/containers). For Nvidia graphic cards the file `docker-compose-gui-nvidia.yml` in combination with the [`nvidia-container-runtime`](https://nvidia.github.io/nvidia-container-runtime/) has to be used instead.\nAfter it is done building, **connect the Velodyne lidar**, start the container\n\n```shell\n$ docker compose -f docker-compose-gui.yml up\n```\nand launch the [corresponding **Velodyne Pointcloud launch file**](https://github.com/ros-drivers/velodyne/tree/ros2/velodyne/launch). E.g. for the VLP-16:\n```shell\n$ source /opt/ros/humble/setup.bash\n$ ros2 launch velodyne velodyne-all-nodes-VLP16-launch.py\n```\nMake sure that the nodes have started correctly with\n\n```bash\n$ ros2 node list\n```\n\nand check if the topics are published correctly with\n\n```shell\n$ ros2 topic list\n```\nin combination with\n\n```shell\n$ ros2 topic info \u003ctopic_name\u003e\n```\n\nFinally **visualize the points with Rviz** by launching\n\n```shell\n$ ros2 run rviz2 rviz2 -f velodyne\n```\nin another terminal and display the pointcloud published by the Velodyne.\n\n![Velodyne VLP-16 visualization in Rviz](./media/velodyne-rviz2.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2b-t%2Fvelodyne-ros2-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2b-t%2Fvelodyne-ros2-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2b-t%2Fvelodyne-ros2-docker/lists"}