Skip to content

bkuangs/f1tenth_lab4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lab 4: Follow the Gap

Assignment link: https://github.com/f1tenth/f1tenth_lab4_template

Deliverable: Video submission of the car traversing through both the lavine_blocked and lavine_obs maps

Submission video: https://youtu.be/LDZb-whA4a8

New Concepts/Functions

  • LIDAR scan pre-processing
    • np.convolve: Calculate a moving average. In this case, the function multiplies all values in the window by 1/window and then sums the values to find the average
    • np.clip: Set a floor and ceiling on values in the array
  • Finding max_gap: LeetCode-style function to find the max consecutive length of non-zero values within array
  • Safety bubble calculation

Blockers

1. Car immediately wanted to turn right and drive in a circle
Reason: The biggest empty space(max_gap) was actually behind the car
Solution: Limit FOV to front 180 degrees

2. Circular driving problem was not fixed
Reason: In the open hallway, all LIDAR hits are going to be at the ceiling we set (3.0), causing the argmax function to default to the first index (start of the gap)
Solution: Set best_point to the center of our chosen gap rather than furthest point

3. The wiggling problem when driving down an open hallway
Reason: The "center of the gap" jitters slightly every frame - the car chases this jitter
Solution:
a. Set a pre-determined alpha value to smooth the steering changes
b. Increase window_size from 5 to 20

4. Car runs into Block 2
Solution: We update our logic for the find_best_point function

Alt text

Why doesn't a safety bubble appear around the second obstacle and force a turn?

  • The bubble logic only "zeros out" the closest obstacle - Block 1 is closest, which the bubble protects us from
  • By the time Block 2 becomes the "closest object" and gets a bubble, the car is already driving directly at it
  • Our logic finds max_gap by looking only for non-zero ranges; this is a problem because an obstacle can still exist inside this gap, as long as it is some distance away
  • Once our direction is set towards the center of this false gap, we drive straight into an obstacle

How does the updated logic fix this?

  • We will now create a sub-gap within max_gap that aims for the deepest open space - obstacles will be filtered out because they are "shallow" compared to the max depth

5. Car turns too sharp to the left to avoid Block 2, then drives straight into Block 3
Reason: Overcommitment; the "deepest point" logic sees the huge open space to the left of Block 2, steers the car toward the center of that open space (far left), but then fails to re-adjust in time to avoid Block 3
Solution:
a. Shrink the size of the pre-determined safety bubble to allow us to be closer to obstacles (smoother turns)
b. Slow down the speed on turns to give us more time to adjust (braking gain)

6. Car drives into the dead-end on the left
Reason: The dead end appears just as good as the right route
Solution: Modify find_best_point function to collect a list of gaps and "score" each gap based on depth and width, weighting depth more

Alt text

7. Car drives into right corner rather than making this left turn around the block
Reason: Around a corner or T-junction, the dead-end corner is the furthest point. The valid left turn fails the threshold check because it isn't "deep enough" compared to the corner, routing us into the corner
Solution: a. Narrow FOV from 90 to 60 degrees so that it doesn't consider the open space too far to the right
b. Implement steering_reactivity variable to make the car steer harder when around obstacles (sort of a double-edged sword)

Alt text

About

Follow the Gap for Obstacle Avoidance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •