Lejun's Blog

'22 MSE in Robotics @ Penn
'20 BSE in MechE, Minor in EE @ UMich
'20 BSE in ECE @ SJTU

0%

F1Tenth Autonomous Racing Cars - Lab 4 (Reactive Planner "Follow the Gap")

During the Spring 2021 semester, I joined the F1Tenth team at Penn to conduct an interest project on multi-vehicle coordination. To get prepared for the project, I self-learned and completed Lab 1, 2, 3, 4, and 6 of the “F1Tenth” course.

Overview

This post contains my results for Lab 4, where a reactive planning method for obstable avoidance “Follow the Gap” is implemented for the race car so that it can avoid obstacles and complete a loop of the Levine Hall smoothly. See the video below for a demonstration of the reactive planner:

Demonstration

Procedure

The big picture of the algorithm is shown below:

The general steps of the "Follow the Gap" algorithm.The general steps of the "Follow the Gap" algorithm.

My customized implementation of the algorithm can be summarized in the following steps:

  1. Obtain laser scans and preprocess them: Since the laser scan data will be accompanied with noises and potential “nan” or “inf” values, I first clip the laser scan data into a range of [0, range_max] (range_max is provided by the lidar message itself, indicating the maximum valid laser scan data). Then I used a sliding window of size 5 to obtain average values of the laser scan data, which could help with eliminating the noises.
  2. Find the closest point in the lidar scan data: In this step I use the preprocessed lidar scan data to find the closest point in the vehicle’s front of view (between -70 and 70 degrees).
  3. Draw a safety “bubble” around this closest point and set all points inside this “bubble” to 0. All other non-zero points are now considered “gaps” or “free space”.
  4. Find the max length “gap”, in other words, the largest number of consecutive non-zero elements in the processed lidar scan data array.
  5. Find the best goal point in this gap. This is defined to be the furthest point away in the gap. In the case of multiple points sharing the same distance, the one that is at the smallest absolute angle to the vehicle’s frame will be chosen as the goal point.
  6. Actuate the car to move towards this goal point.

More technical details can be found in the below prompt document:

My source codes for this lab can be found on github through this link.

Reference

The lecture video can be found below: