0:00

Welcome to week six.

Â This week I'm going to be talking about following walls.

Â Why do we need to follow walls?

Â Well, last week we solved the navi,

Â we somehow seemed to solve the navigation problem.

Â We had our robot drive from point A to

Â point B without colliding with any of the obstacles.

Â But, the obstacles were fairly easy, and.

Â The reason for this is that they're convex.

Â But we can have these obstacles that are concave in shape.

Â So, for example,

Â take this U-shaped obstacle, and if a robot starts here

Â and it's goal location is on the other side of

Â the obstacle, what will happen with the controllers that we

Â designed last week is that the robot will drive from here.

Â Into the obstacle, and then start avoiding the

Â obstacle, and then drive back into the obstacle.

Â Because it's always trying to get to this side, but also avoiding this obstacle.

Â But it's trapped in here.

Â because the shape of the obstacle is concave.

Â 0:52

So what we need is an additional controller, the follow-all

Â controller, that will, so that when we make a decision

Â that we're inside of our concave obstacle, then we're going to

Â follow the contour of the, the boundary of this object, and.

Â We're going to follow it all the way around until we've

Â cleared it and then we can proceed onto the goal location.

Â 1:24

And once we've, once we've estimated a section, we're basically

Â going to figure out a vector that's tangential to the wall.

Â And also one that's perpendicular to the wall.

Â And the point is to combine these two vectors into a single

Â vector that will not only steer the robot into,into one direction along.

Â The the, the, the contour of the, the boundary of the wall.

Â But also a vector that will make sure that the robot

Â neither steers into, into the wall or away from the wall.

Â So we're going to maintain some distance from the wall as we follow it.

Â 1:59

Now.

Â How is the robot going to estimate the wall?

Â Well, first of all, one of the two inputs into the

Â controller is going, is going to be either left or right.

Â So we are either going to follow a wall thats to our left or to our right.

Â So we have to make that decision before we do anything else.

Â If we decide that we are going to use.

Â 2:20

The left the left direction. What we're going to

Â do, is we're going to use sensors one, two, and three on the robot.

Â So we're going to use these three sensors.

Â to, to estimate a wall that's the left, or

Â an obstacle that's to the left of of the robot.

Â 2:39

And.

Â What we'll do is we'll pick of these three we're

Â going to pick the two, that have the shortest infrared sensor readings.

Â And, we already know how to get a point, on these in the world frame.

Â So, what we end up is we end up with a point so.

Â 2:55

We have, this point right here which I'm going to denote as, point 1.

Â And, this is going to be point 2.

Â So, we've picked these two, and since we've picked two points

Â in the world, we can come up with a vector right?

Â So, we're going to come up with this green vector right here.

Â And, this green vector is going to be our vector

Â that's tangential to the wall.

Â So I'm going to call this u, the vector u

Â 3:20

fw denotes that, this is for the follow wall, and.

Â Comma T denotes that this is tangential to the wall.

Â And really, the way that you define it is, it's p2 minus p1.

Â That's the definition of this, of this vector.

Â Now, I also said that we want to maintain some spacing from the wall.

Â So we're going to have to calculate

Â a vector that's perpendicular.

Â 3:43

And the way that we're going to calculate it is,

Â again, we have the vector from the previous slide.

Â We have u_fw_tp, and this time it has a prime

Â mark, and that's because I'm going to normali, normalize it, and.

Â Thus, and again, I think last week I talked about this is, what we're

Â going to do is we're going to just take

Â the vector, and divide it by its magnitude.

Â So that's the,

Â that's the normalized version of the of that vector.

Â And what we'll do is we'll first take a

Â point on this vector, which is going to be ua, and.

Â 5:25

It's this, so this vector, this perpendicular

Â vector I'm denoting by u sub fw, p.

Â And it's this subtraction of these points dotted.

Â With a dot product of, of the tangential vector

Â and then multiply it again by the tangential vector.

Â So this is just some linear algebra that gives me a vector from the

Â robot to the closest point on the

Â wall, that's, that lies on the tangential vector.

Â 5:53

And, this is not sufficient for us to maintain spacing yet.

Â What we really want to do, is we want to find another vector that's goes in

Â the opposite direction, and, and again from

Â the previous slide I have this perpendicular vector,

Â so all I'm going to do is I'm going

Â to normalize it and multiply it by some distance fw.

Â So d sub fw.

Â And.

Â 6:35

So the reason that I define this vector like, like so is that when we can combine.

Â The two together.

Â If we combine these two vectors together, we're

Â going to get a vector that either points us

Â toward the wall if the robot is farther than

Â d fw from the obstacle, or from the wall.

Â And we're going to get a vector that points us.

Â 7:14

And really, what ends up happening is if we div if we.

Â Somehow linearly combine the, tangential vector to the, to the wall.

Â And the perpendicular vector

Â the, to the wall, that you know either

Â points us towards or away depending on the distance.

Â If we combine those in some way, we're going to get a, vector,

Â u sub fw, which will both.

Â Point us in the direction in which the wall is going to, that allows

Â us to follow the wall, and it also has the component that either pushes us towards or

Â away from the wall depending on how close or far we

Â are away from the obstacle, and this is exactly what we wanted.

Â 8:12

So how all does this work?

Â Well, you saw in the previous slides that I got a really good

Â estimate of, of, of the, of the, of a section of the wall.

Â But that's not always the case.

Â So, for example here on the inside corner, what I have here is

Â this is the robot's estimate of, of the, of the wall.

Â And you can see that this is an overestimate.

Â So, we're actually okay with that, because if

Â we're overestimating the wall, that's, you know, that's

Â not really problematic because we're not going to.

Â We're going to avoid this, this virtual piece of

Â the wall and we're not going to slam into it.

Â There's no danger of, real danger of that. But that is on, these inside corners.

Â On the outside corners we are underestimating the wall.

Â So you can see here that the robot thinks that this represents.

Â Is it

Â a good representation of the wall?

Â And if we cut this corner too closely the robot collide with this

Â part of the obstacle that it doesn't really sense because there's a little

Â bit of spread between the sensors because we don't have, you know, 20,

Â 20 sensors on the robot that cover every single inch outside the robot.

Â We only have five sensors, so we got to make,

Â deal with what we have, so here we have to

Â be a little careful, and that's where the design of this distance, d

Â sub fw comes into play. So, you want to make sure that this, this,

Â value is large enough to allow us to not cut corners and collide with the wall.

Â But also not too large so, so that we don't lose track

Â of the wall, because we don't want to end up too far away

Â from the wall and then the robot doesn't sense

Â the wall anymore and we can no longer follow it.

Â So, we want to kind of stick to the wall as

Â close as possible, but not too close to collide.

Â 10:04

Now the implementation is going to happen in a new controller, FollowWall.m.

Â And you're going to have to implement some missing logic and,

Â and, and math that was covered in the previous slides.

Â And ag, also again covered in

Â the, in the manual in much greater detail. And.

Â 10:23

As I said before the, what's, what's really unique about

Â this controller its going to accept either left or right

Â denoting which side of, which side of the robot the

Â wall is going to be in which its going to follow.

Â So we're going to tell it you're going to have to

Â follow a wall that's going be on your left

Â or we're going to tell you you're going to have to

Â follow an op a wall that's on your right.

Â And that those are going to be inputs and those [INAUDIBLE], really come into play.

Â And next week when we have our full navigation

Â 11:32

So this is pretty, pretty much a little too close for comfort.

Â But, you know, we're not crashing into the, into the obstacles.

Â So we're, we're, we're gon, we're okay with that.

Â 11:44

Alright. Great.

Â So, the robot's going to follow this wall on and on and on until I close this.

Â Now, again, make sure re-read the manual

Â for weeks, that's been updated for week six.

Â It has a lot more details especially, you know, for

Â the math and, and has diagrams that will help you.

Â 12:09

And

Â I encourage you to experiment with different values

Â of the distance to maintain from the wall.

Â So you'll see different results for different distances that you pick.

Â And also you can decide how to combine the two vectors that

Â are tangential and, and perpendicular, to the, to the wall, and, and, and.

Â In different ways, so.

Â And it depends on where you want to put the emphasis.

Â You might want to put the emphasis strictly

Â on following the law, on following the

Â law, and not worry about maintaining a distance

Â too much, or you could do the converse of that, it's really up to you.

Â