Lab 5: LIDAR

So far, we have primarily used the car’s camera to view the world in front of the car Unfortunately, the camera cannot see to the side or rear of the car, which makes other tasks such as wall following more difficult.

In this lab, we will use the LIDAR to gain a 360 degree view around the car and use this expanded field of view to solve new problems such as wall following.


A SLAM map generated by the RACECAR-MN LIDAR (shown in RVIZ).


Main objective

Use the LIDAR to increase the car’s field of view and use this to complete new navigational tasks.

Learning objectives

  • Explore the SLAM visualization using the LIDAR.
  • Use the LIDAR Module to extract LIDAR information.
  • Use the LIDAR information to respond to objects around the car.



We wil use RVIZ to perform LIDAR SLAM.

  1. If not already running, start the lidar using the command roslaunch ydlidar_ros X4.launch.
  2. Make sure that you have the DISPLAY correctly set to use the car screen for the visualization.
  3. Using the screen on the car (with mouse and keyboard), you will see an RVIZ window will open.
  1. You will see immediately on the screen scan continuously updating.
  2. If you want to see the SLAM map click the Add button in the lower left.
  3. You will see a long list of options, scroll until you find LaserScan. Once added, select the topic as /scan.
  4. Now the points from the Lidar are converted into a SLAM map.
  1. Try navigating the car around the room, to see if you can create a usable SLAM map!
  2. Save the final image you have before closing out of the RVIZ window.

Warm Up: Safety Stop (Revisited)

In the warm up for ref:lab_3, you implemented a safety stop which prevents the car from driving forward into an object. Replace the TODO: (warm up) comment with a new safety stop that works in both directions by also preventing the car from driving backward into an object.

Main Challenge: Wall Following

To navigate a hallway or maze, the car can drive forward along a wall. The car will need to stay within 0.5 to 1 meter away from the wall to its right and turn when the wall reaches a corner.

Replace the TODO: (main challenge) comment with code to follow a wall as described above.