So now that we have established that we
need a goal to goal behavior, and possibly
an avoid obstacle behavior in order to go
between points a and b. and we have
figured out that if we have a differential
drive robot that we can model as a
unicycle. With constant velocity v not.
Then, what we can really control is the,
the heading. And the way we control it is
phi dot is equal to omega. Now, let's
define the error, error equals to phi
desire minus phi. So the desired heading
minus the heading we're in. And then we
could use the PID controller, acting on,
e. And we should remember that we may not
want to act directly on e because it's an
angle, so this little trick with arc
tangents 2 would allow us to ensure that e
stays within minus pi and pi. Okay, let's
use this to actually build a behavior that
takes us to a goal. So, the question then
is, the only unknown here, which is what's
phi desired? Well, say we, we're located
at x and y, we know where the goal is, x
goal and y goal. And, the way we know it
is, either because of the sensor skirt
disc extraction we talked about, or some
other way of knowing the goal location.
Well, it's not very hard to compute what's
the desired angle is. It's simply y goal
minus y divided by x goal minus x, and
then r tangent of that. So phi desired in
this case, of course, is this angle here.
So that's given by this arc tangent
formula. So now all we do is we plug it in
to get the error, then we plug the error
in to get the controller and then we hook
the controller in to get the update on, on
the heading. Okay, so without further ado,
let's do it. Okay, here's my first.
attempt, look at this we're getting there,
what? Alright what just happened here?
This was attempt 1 and well, the robot
started out, started out looking in the
wrong direction and then it was starting
to turn nicely, maybe not enough but, and
then something happened, and it seem to
happen roughly when the angle here was
close to minus pi over 2, but in fact this
is exactly what happened. The problem here
is that I forgot that I was dealing with
angles So the issue is, da, da, da, da,
angles. As we talked about, let's not plug
in angles right away. Let's always make
sure that they are within -pi and pi. And
by the way, only in this case was just k
times the error. So it was a pure p
regulator. No i and no t part. But this is
what happens. Even if you do a nice design
and you forget that you're dealing with
angles instead of other entities. So.
Let's go to attempt two. The same
controller. Now I'm putting omega equal to
within quotations here. This simply means
that it's not exactly this, because I'm
doing the arc tangent 2 on this. And,
let's see what the robot is doing. It's
spiraling around the starry air a little
bit. Eh, not, not that great, I must say.
So what seems to be the matter? Well, the
problem is the following. I'm driving the
car at a constant speed, V naught.
And then I'm turning based on this
equation up here. And it doesn't seem like
I'm turning fast enough. You know, if I'm
going really fast, then I need to turn a
lot to, to, actually get to where I want.
So the problem is simply that I'm not
turning quickly enough. Or maybe I should
slow down when I get closer to an
obstacle. And, in truth, if you're
controlling v and omega at the same time,
you need to be a little bit more, you need
to be cle-, more smart in your control
design than just a PID regulator on the,
the heading error. But, since this is what
we're doing right now, simply what we
should observe is the gain is not high
enough. K is not high enough to steer us
towards where we would like to go. So,
let's do the same thing. But let's make k
bigger. So this is attempt 3. We're doing
the same thing. We have k big. And again,
we have the quotations there, because it's
not exactly this we're doing. What we're
really doing is this arc tan 2 trick on
the, the error on the angles, to make sure
that we get something between -pi and pi.
And, this is just right. This was a
successful control design and in fact,
pure p part, and I don't know if you
remember this video that I showed you that
showed how the metric drift was happening.
It was this video. Well, let's look at it
again. >> Go!
>> And, this time I have the volume up,
because it's really exciting! This is a
competition, and what these robots are
doing is exactly what we just saw.
Obstacle, no, goal to goal using a P
regulator, and this is a competition of
the P games. And, in this case, one robot
did well, and the other was forced out of
bounds. But, this was exactly the
controller. that was running on this kind
of robot.
Okay.
EmoticonEmoticon