This tutorial is no longer being updated. For latest version go to:

RPLiDAR S3 | docs.fictionlab.pl

Home

>

Components

RPLiDAR S3

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

Prerequisites

No items found.

Home

>

Components

RPLiDAR S3

This tutorial will guide you through the process of connecting a LiDAR sensor to 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 wide range of other applications. In robotics 2D lidars, like RPLidar S3, are used for things such as indoor SLAM (Simultaneous localization and mapping) or safety systems.

What to expect?

After finishing the tutorial you should be able to both gather the lidar data and visualize it using RViz. Just like in the image below:

Prerequisites

No items found.

List of components

  • RPLidar S3
  • RPLidar S3 adapter plate (can be found here: https://www.leorover.tech/documentation/addon-adapters)
  • M5x10 Allen head screw x4
  • M2,5x6 Allen head screw x4

Mechanical integration

We developed 3D printable models of mechanical interfaces that allow you to mount the aforementioned sensor to the mounting plate of the rover.

Locating the sensor at the top of the robot provides a vide field of view with not many obstacles for the laser beam to get caught on.

Get the files from here: Leo Rover Documentation - Addon adapters.

With 4x M2.5x6 Allen screws connect the sensor to the printed interface plate.
Use 4x M5x10 Allen screws to fasten the sensor to the Leo Rover.

Wiring and electronics connection

The sensor can be connected to the robot's main computer via the USB socket positioned at the top of the rover.
If your USB cable is long it might get into lidars field of view if it sticks up too much. try to hide it in the empty space inside Leo Rovers back frame. Just like on the photo below:

USB connection provides power to the sensor and allows the data transfer. This means that no external power sources are necessary.

However, if lidar isn't the only thing connected to the rover you might need external power connection.  Powerbox might come in handy in such situations.

With everything connected you are ready to try out your new sensor.

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

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.

/etc/ros/robot.launch

Your robot should be aware of where the sensor 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

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

Now just add the LaserScan data (Add -> By topic and look for /scan or LaserScan), and that's it.

Here's an example end result:

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