LiDAR Basics & Control

Light Detection and Ranging

Active optical sensors such as 2D LiDAR's (Light Detection And Ranging) are used to perform scanning and detection of surfaces surrounding our robot. These electronic sensors emit light on the horizontal plane, usually the X-Y plane. Based on the captured reflected light, an accurate representation of the distance of the object is known.

Wolf uses RPLIDAR A1 which runs clockwise to perform a 360 degree omnidirectional laser range scanning for its surrounding environment and then generate an outline map for the environment.

RPLIDAR A1 Specifications

Key Parameters
Value

Measuring Range

0.15m - 12m

Sampling Frequency

8K

Rotational Speed

5.5Hz

Angular Resolution

≤1°

System Voltage

5V

System Current

100mA

Output

UART Serial

LiDAR Data in Simulation

To simulate LiDar in Gazebo and Rviz, copy wolf-robot folder fromt5_lidar_interface to workspace. Run Gazebo with our previous construction world:

ros2 launch wolf-robot launch_sim.launch.py world:=./src/wolf-robot/worlds/construction.world

Run Teleop Keyboard to control our simulated robot

ros2 run teleop_twist_keyboard teleop_twist_keyboard # to control the robot

You can see the scanned data in Gazebo. Run rviz2 to see obstacle points on Rviz window

LiDAR on a Real Robot

We need to install LiDAR package to communicate and control our LiDAR. Install the package @robot and not on the @dev machine.

In the next terminal, run rplidar_composition

Since there are two devices connected to USB, it sometimes may clash and not respond. To assign a port for a sensor:

Note down the path of LiDAR and update <path> in command below.

We can also find more details of the device if required. Connect USB device (only 1) to laptop and type as below

To start or stop the motor, type the following command on @dev machine to run service:

To check if rp_lidar service (or any ROS 2 Services) are running, type:

Launch File

All the commands to run and control LiDAR is placed in a launch file. To launch LiDAR control, type the following on @robot machine:

Lastly, if in some cases the launch file terminal is stuck, open a new windows and type the following to kill the service:

Last updated