Home

>

Components

Hokuyo LiDAR

This tutorial will guide you through the process of connecting a LiDAR sensor to your Leo Rover.

Prerequisites

Home

>

Components

Hokuyo LiDAR

This tutorial will guide you through the process of connecting a LiDAR sensor to your Leo Rover.

2D LiDAR sensors are widely used in robotics for things such as indoor SLAM (Simultaneous localization and mapping) or safety systems.

In this tutorial, we will present the process of connecting a LiDAR sensor to your Leo Rover and integrating it with the system on the Hokuyo URG-04LX-UG01 example – a compact, affordable scanning laser rangefinder.

Hokuyo laser scanner

The steps might slightly differ for other LiDAR sensors but should be essentially similar.

See more information on the Hokuyo UG-04LX-UG01 device here.

What to expect?

After completing this tutorial, you should be able to visualize the model and data from the sensor like in the image below.


Prerequisites

List of components

  • Hokuyo URG-04LX-UG01
  • a 3d-printed 04008 Hokuyo URG-04LX adapter
  • miniUSB-USB A cable (provided by default with Leo Rover)
  • 4x m5x10 mounting screws
  • 2x m3x10 mounting screws

Available in our offer - Hokuyo URG Lidar with adapter

Mechanical integration

When mounting the sensor, you should be particularly careful not to obstruct the field of view by other parts of the Rover.

We developed 3D printable models of parts that allow for mounting the aforementioned laser rangefinder to the mounting plate located at the top of the robot. The files are listed here:

04008 Hokuyo URG-04LX adapter

Wiring and electronics connection

The sensor can be connected to the robot's main computer via the mounting plate USB socket.

As for the power supply, you will have to provide additional connection from the robot's battery to the sensor through a 5V DC converter (if the sensor is not powered via the USB socket).

The mounted sensor should look similar to this:

Hokuyo sensor on Leo Rover

Software integration

The first thing you can do is to make sure your device has the correct permissions and is available at the fixed path on your system. To do this, you can add the following rule to the udev service:

/etc/udev/rules.d/lidar.rules

Paste these lines to /etc/udev/rules.d/lidar.rules file and reload udev rules by typing:

Your device should now be available at the /dev/lidar path.

We want the sensor functionality to be available in the ROS ecosystem, so you should install a ROS package that provides a node for the sensor you are trying to integrate.

Now, create a launch file that would start the node with a fitting configuration.

/etc/ros/laser.launch

Include your launch file in the robot.launch file, so that your node will start at boot.

In /etc/ros/robot.launch:

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.

/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.

Examples

Reading and visualizing the data of the Hokuyo laser scanner

The robot should now publish the LaserScan messages on the /scan 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 another 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.

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

A screenshot of the Displays panel

You should now be able to see the data from the sensor visualized as points in 3D space.

To put the points into the camera image, you can also add the Camera display.

Adding the Camera display

Be sure to check compressed as the Transport Hint and /camera/image_raw as the Image Topic.

Transport Hint and Image Topic

What next?

Contents

Need help? Contact us - contact@fictionlab.pl