I want to connect Velodyne Lidar(VLP-16) to docker environment. But I have a problem.
I can’t Lidar data in docker environment. Lidar works fine because I can get Lidar data successfully in Ubuntu-18.04(not docker environment).
my computer’s IP is 192.168.10.250, and Lidar’s IP is 192.168.10.201 (I changed Lidar’s IP to connect my computer).
But, vEthernet(WSL)’s IP is 172.19.208.1 (may be changed when my computer reboot, and it will be 172.19.xx.xx).
And my docker’s IP is 172.17.0.xx (docker0 IP).
-
I wonder why I can ping successfully to Lidar from docker environment, even if computer’s ip(192.168.10.xx) and docker’s ip(172.17.0.xx) are different.
-
Although Lidar and Docker are connected(I can ping to Lidar from docker environment), I cannot get Lidar’s data. I have the following problem when I enter these commands.
- commands :
-
catkin_make (success)
-
source setup.bash (success)
-
roslaunch velodyne_pointcloud VLP16_points.launch (error!)
- error message : error message
I think I have similar problem in https://github.com/ros-drivers/velodyne/issues/232 .
But I can’t solve it.
- I already modify port number ‘2368’ in /catkin_ws/src/velodyne/velodyne_pointcloud/launch/VLP16_points.luanch
- I installed ros:melodic to use Velodyne Lidar
Thank you.
2
Answers
This issue is because the subnet your docker container uses is different than that of your LIDAR. The Velodyne operates on a
255.255.0.0
subnet where the first two octets are different than the container. The easiest way to fix this is to change those LIDAR settings to match what your container uses.This would look something like having the
Host
field be your container IP:172.17.xx.xx
and making sure the velodyne is on the same subnet:172.17.10.201
This error is caused by the launch program could not hear from the velodyne with specified IP. The reason is that network of velodyne and docker is different (mostly 192.168.x.x for LiDAR, and 172.17.x.x for docker).
The easiest way to solve this question is to run your docker with
--network host
. Then the docker network would be the same with the host.