So you can also use potential field navigation or proportional control for obstacle avoidance. And the way this works is that you represent the obstacle as a factor that's pushing the robot away. So when the robot is really far from the obstacle, it goes at full speed. And as it gets closer to the obstacle, it slows down and order not to hit it. You can also think of potential field navigation as a way of repelling the robot. So if the robot is already close, it pushes it back. So you can look at this two ways, a robot driving in and slowing down as you get close to the obstacle. And then driving away and getting faster, the further it gets away. So let's take a look. Alright, here we are, full speed ahead. And then as the obstacle gets closer for proportional to how close it is, the robot slows down. And then when it gets within five inches, it stops. Now obstacle avoidance is not only about not hitting but moving away. So it's going to move away slowly and as it gets further away, it moves away faster. Then once it's in the clear, it stops. Let's try that again. Full speed ahead. Then it slows down as it gets closer to the obstacle, slower, slower, too close. It stops. And then eventually it's going to want to back away. The further it gets away, the faster it goes. Until it's in the clear. And that's proportional control for obstacle avoidance. So this loop implements the proportional control. The first thing that happens is we use a variable to read the distance. We print the distance for debugging. Then we set if the robot state is moving toward the obstacle, then it's full speed ahead. If the distance is greater than 15 inches, then it is halfway there. If the distance is greater than 10 inches, greater than five inches, getting close. And then less than five inches, the robot stops. Then we set the robot state to two to move away. We wait to read the sensor again. And move away state. If the distance is less than five inches, we will move backwards because slowly because we're close to the obstacle. Then a little faster as we're getting further away. And then when it's less than 15 inches, it's full speed away. After that, the robot is stopped because it's clear of the obstacle.