Documentation is being migrated to the new website: docs.fictionlab.pl

This Knowledge base will soon be deprecated.

Home

>

Components

Velodyne Puck (VLP-16) LiDAR

This tutorial will guide you through the process of connecting and using Velodyne Puck LiDAR sensor on your rover.

Prerequisites

No items found.

Home

>

Components

Velodyne Puck (VLP-16) LiDAR

This tutorial will guide you through the process of connecting and using Velodyne Puck LiDAR sensor on your rover.

Light Detection and Ranging devices, or Lidars for short, are mechanisms used for mapping the environment, object detection, tracking the speed of vehicles and in a vide range of other applications. The VLP-16 has a range of 100 m, and the sensor's low power consumption (~8 W), light weight (830 g), compact footprint (~Ø103 mm x 72 mm), and dual return capability make it ideal not only for autonomous vehicles but also robotics and mobile terrestrial 3D mapping applications.

What to expect?

After finishing the tutorial you will have configured the Velodyne Puck LiDAR to work on your rover. You will be able to gather and visualize the data from the sensor.

Prerequisites

No items found.

List of components

Mechanical integration

It's common for 3D lidars to be attached some distance above the mounting plate of a robot. This procedure allows you to avoid the need to filter data related to the reflection of the laser beam from the robot's elements.

The easiest solution for attaching the Velodyne Puck above the mounting plate of a Leo Rover would be using our Universal Camera Mast.
However, you can also design a custom solution eg. like the one shown in the picture below.

Wiring and electronics connection

Whatever your mounting solution might be, You'll still have to connect the lidar to the rover somehow.

The USB port placed on the mounting plate of the rover is not going to be enough. In order for the Lidar to work You'll have to provide an ethernet connection between it, and the rover.

Kacper from our team likes to remove the micro-usb port entirely and run the wire straight through the newly created hole. This solution, combined with the use of a cable gland, keeps the MEB box waterproof.

Second common solution involves printing a new cover for the MEB box. Dev cover found here, provides a wide opening for running wires straight into the MEB. This solution can be extremely useful in projects that don't need to be waterproof.

In order to provide enough power for the Lidar you'll need an external power connection.  Powerbox might come in handy as it provides multiple 5V and battery voltage outputs.

Software integration

Configuring the sensor for the rover

In this section Velodyne Puck will be connected to a PC in order to modify its configuration for the rover. These instructions will contain setup on a PC with Ubuntu. If you are looking to connect to the sensor on Windows you can checkout VLP-16 User Manual (chapters 4.1.2 and 4.2.2).

If in this part you encounter problems you can try turning off your WiFi.

Power the LiDAR via the included adapter and connect the sensor to an ethernet port on your computer.

Go to the Network tab in settings and enter Wired settings.

In the wired settings go to IPv4 tab, choose manual IPv4 method, type in the IP for your computer (in this tutorial this IP will be 192.168.1.100 however you can choose any IP in that network that is not sensor's IP), add a 255.255.255.0 Netmask and then click Apply.

Open the terminal and add a static route do the sensor's IP address - by default it should be 192.168.1.201. Replace eth0 with your ethernet interface signature - you can find this using ifconfig command.

Now you should be able to connect to the sensor. You can check the connection by pinging the LiDAR.

Open your browser and type in the sensor's IP address (192.168.1.201). The following page should appear:

In these settings scroll down and in Host (Destination) section change IP Address to 10.0.0.1 and click Set. In Network (Sensor) section change DHCP to On and click Set. Finally click Save Configuration button.

For a better understanding of what each option does you can use VLP-16 User Manual.

You can now disconnect and power down the sensor. After it's next booted up these changes will persist.

Setting up the Velodyne sensor on the rover

Power the LiDAR via the adapter and connect in to the ethernet port on the rover's Raspberry PI.

Now the sensor will get an IP assigned by rover's DHCP server. You can check this IP by installing and using nmap.

In output there will also be the address of Raspberry Pi and other devices connected to the rover such as your computer, however other connections should have distinctive names, such as leo (10.0.0.1).

To make sure that the sensor is connected you can type its IP address (the one from nmap result) into the browser and you should see the VLP-16 User Interface - the same as in the previous configuration.

From now on remember to use this new IP if sensor's IP is needed in any of the other modules.

ROS software installation

Make sure that system date is correct by writing this command in the terminal.

If the date is not correct you can set it to current date. Replace YYYY-MM-DD HH:MM:SS with current date and time e.g. 2023-01-31 09:00:00.

Next make sure that all your packages are up to date.

Now you can install Velodyne ROS package. Replace ROSDISTRO with your ROS version e.g. noetic.

If you haven't already, setup a ROS workspace.

Go to the src directory in your workspace and clone a repository with Velodyne Driver.

Go back to main workspace directory and install ROS dependencies. Replace ROSDISTRO with your ROS version e.g. noetic.

You can now build your workspace.

Adding Velodyne puck to URDF - TODO change urdf after mechanical integration

Your robot should be aware of where the scanner is located and what space it occupies. You can ensure it does that by creating a URDF model of the sensor in /etc/ros/urdf directory.

/etc/ros/urdf/laser.urdf.xacro

And including it in the description that is uploaded at boot.

/etc/ros/urdf/robot.urdf.xacro

You can experiment with the URDF file and create a more representative model of the sensor by adding more visual and collision tags or by including meshes in STL or COLLADA format.

The last step is to either reboot the robot or restart the leo service.

Running Velodyne Puck ROS node

To run the node type:

Adding the node to autostart

Open /etc/ros/robot.launch and add this line inside <launch> tag:

Now you can reboot the robot or restart the leo service

Modifying Velodyne Puck configuration to be more power efficient (optional)

If you are not using the LiDAR at all times (its ROS node is not running at all times) you can use instructions below to prolong battery life. By default Velodyne Puck turns on its motor and laser on power up which consumes a lot of battery. However its configuration can be adjusted not to not turn on on power up and a ROS node can be added to turn the sensor on when needed.

To do that you need to reconfigure Velodyne Puck first.

Enter the configuration site in your web browser by typing sensor's IP.

In the settings turn laser off and set motor RPM to 0.

Next scroll down and click save configuration. Now the motor and laser should not be running after power up.

Now you can go to your the velodyne_pointcloud directory where the scripts will be added.

In this directory create config_velodyne.sh and velodyne_config_manager.py and copy the code below into them.

/ros_ws/src/velodyne/velodyne_pointcloud/scripts/config_velodyne.sh

/ros_ws/src/velodyne/velodyne_pointcloud/scripts/velodyne_config_manager.py

Create a launch file for the node. Remember to change the value of target_ip parameter to your Velodyne Puck IP.

/ros_ws/src/velodyne/velodyne_pointcloud/launch/leo_velodyne.launch

Now you can add the following lines to CMakeLists.txt of the velodyne_pointcloud package:

/ros_ws/src/velodyne/velodyne_pointcloud/CMakeLists.txt

Build the workspace.

To run the LiDAR you can now use:

If the sensor is launched this way and connection to it can be established, ROS services to turn the LiDAR on or off are available.

Examples

Reading and visualizing the data

The robot should publish the PointCloud2 messages on the /velodyne_points topic. You can check the raw data that it sends by typing:

If you have ROS installed on your computer, you can get a more graphical representation of the data with RViz. If you don't have ROS, you can follow this guide:

Install ROS on your computer

Before starting RViz, make sure you completed the Connecting other computer to ROS network section of ROS Development tutorial:

ROS Development

Now, open RViz by typing rviz in the terminal, or, if you have the leo_viz package installed, type:

This will start RViz with visualization of the current robot model.

In Global Options change Fixed Frame to velodyne.

On the Displays panel click Add -> By topic and search for the /velodyne_points topic. Choose the PointCloud2 display and click Ok.

Visualized pointcloud should look like this:

What next?

LiDARs are commonly used in projects involving autonomous navigation, you might be interested in a tutorial about it. They are however, not the only way of teaching a Leo Rover how to move on it's own. Check out our line follower tutorial if you want to learn more. You can also check our Knowledge Base for more instructions.

Contents

Need help? Contact us - contact@fictionlab.pl