Skip to content
MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
MathWorks
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out

Videos and Webinars

  • MathWorks
  • Videos
  • Videos Home
  • Search
  • Videos Home
  • Search
  • Contact sales
  • Trial software
3:31 Video length is 3:31.
  • Description
  • Full Transcript
  • Related Resources

Build a Collision Warning System with 2D Lidar Using MATLAB

Use Lidar Toolbox™ functionalities to build a system that can issue collision warnings based on 2D lidar scans in a simulated warehouse arena.

Learn how to simulate a robot workspace with obstacles, generate 2D lidar data, detect obstacles based on 2D lidar scans, and provide a timely warning before an impending collision.

2D lidars are widely used in autonomous navigation applications like 2D SLAM, obstacle detection, and collision warning in robotics and autonomous driving. In this video, I'll demonstrate how to build a collision warning system with 2D lidar using an example from lidar toolbox documentation.

The workflow involves four main steps. The first, simulate robot workspace with obstacles. And then generate 2D lidar data, followed by detecting obstacles. And finally, provide a timely warning before any impending collision.

We'll start by loading synthetic map of our warehouse arena with obstacles in which our virtual robot will operate. We'll create occupancy maps to represent our arena, which is very common in robotics workflows. Each cell in the occupancy grid has a value representing the occupancy status of that cell. An occupied location is represented as 1, and a free location is represented as 0. The triangle in the map represent of our robot.

We can now add a simulated 2D lidar sensor on our robot using rangeSensor object. The rangeSensor system object is the range-bearing sensor that is capable of outputting range and angle measurements based on the given sensor pose and obstacles in the occupancy map.

Now that we have our arena and robot, we will define detection area of lidar sensor using an interactive interface. The detection area represents area around the 2D lidar, where the system will provide collision warnings if an obstacle is detected. We can use this interface to make different shapes and modify detection areas around the lidar to [? detect ?] any 2D lidar of our choice.

The detection area is divided into three levels. The black region is the dangerous region where collision is imminent. The red region represents high chance of coalition. And the yellow region represents the area where caution measures can be applied to avoid any collision.

The robot will now traverse through the viewpoints, and for each viewpoint, we'll look through the following steps to provide collision warnings. First, we stream data from lidar sensor as lidarScan object. The lidarScan object contains range and angle data for a simple 2D lidar. We then segment point cloud data into clusters of obstacles using pcsegdist function. This function segments point clouds into clusters based on the Euclidean distance between the points.

Now, look over each obstacle clusters to check any possible collision. We can find the danger level based on where the obstacle is in the detection arena. Finally, we issue a warning based on the danger limit. A low warning circle denotes that there is an obstacle in the detection region, and action can be taken to avoid collision with it. Red warning circle denotes a possible collision, and a black circle denotes an imminent collision. We can further use these collision warnings for safe autonomous navigation of our robot in the warehouse arena.

Please follow the links below to learn more. If you have any questions or comments, please let us know.

Related Products

  • Lidar Toolbox
  • Navigation Toolbox

3 Ways to Speed Up Model Predictive Controllers

Read white paper

A Practical Guide to Deep Learning: From Data to Deployment

Read ebook

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

Deep Learning and Traditional Machine Learning: Choosing the Right Approach

Read ebook

Hardware-in-the-Loop Testing for Power Electronics Control Design

Read white paper

Predictive Maintenance with MATLAB

Read ebook

Electric Vehicle Modeling and Simulation - Architecture to Deployment : Webinar Series

Register for Free

How much do you know about power conversion control?

Start quiz

Feedback

Featured Product

Lidar Toolbox

  • Request Trial
  • Get Pricing

Up Next:

1:49
Set Up Polyspace Projects from Your Build System

Related Videos:

48:12
Using MATLAB with PI System for Analysis and Process...
28:34
Controlling a Robotic System with MATLAB and Simulink Using...
37:02
Diesel Engine Aftertreatment System Development Using...
2:37
The Smart Emergency Response System Using MATLAB and...

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contact sales
  • Trial software

MathWorks

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Discover…

Explore Products

  • MATLAB
  • Simulink
  • Student Software
  • Hardware Support
  • File Exchange

Try or Buy

  • Downloads
  • Trial Software
  • Contact Sales
  • Pricing and Licensing
  • How to Buy

Learn to Use

  • Documentation
  • Tutorials
  • Examples
  • Videos and Webinars
  • Training

Get Support

  • Installation Help
  • MATLAB Answers
  • Consulting
  • License Center
  • Contact Support

About MathWorks

  • Careers
  • Newsroom
  • Social Mission
  • Customer Stories
  • About MathWorks
  • Select a Web Site United States
  • Trust Center
  • Trademarks
  • Privacy Policy
  • Preventing Piracy
  • Application Status

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Join the conversation