Hi, and welcome to Glue Lecture 5, Control of Mobile Robots. I'm Smriti Chopra, your instructor for the Glue Lectures. And this lecture is titled, Hybrid Automata. So this week, Dr. Egerstedt uh,introduced to you guys this concept of hybrid control, right? Where a system, or in our case, a robot, has to go through these different behaviors in order to complete a task. For example go to goal, avoid obstacle, hop skip jump, whatever. Different behaviors in order to complete a task. And the problem with that is, or not the problem, but what you need to keep in mind, is that now suddenly we need a bigger model that takes into account all these little models or little behaviors of the robots. And how do we do that? We do that through something called a hybrid automata, which takes into account all these continuous dynamics, and yet, switching logic, to switch between different dynamics or different behaviors. So basically, an example of a hybrid automata is this. Guy here, and it's really nothing but a finite state machine. And a state machine is something that just skips between different states, etc. So we have a q, for example, is your counter for different states. So when q is 1, you're in this state. When q is 2, you're here. When q is 3, you're here. And each mode, or each state, in itself has different dynamics, x dots. Right? Or different behaviors or modes. And then you have these guard conditions that tell when you want to switch from one mode to another. Pretty simple. And then we have what we call resets. Which is basically once you do switch to a different mode, do you change your state in any way or not. It's just something you can add into the automata. So this is a simple example of what a hybrid automata looks like. And then we while studying this hybrid automata, came across this phenomenon called Zeno effect, right? And what is that, really? It's this annoying thing that makes your state or your system just kind of go really fast between your guard conditions. So here your guard, when it's less than 0, you go from x dot f1 to f2. When it's greater than equal to 0, you switch back. But the problem is when it's equal to 0, you switch, and then you just keep switching between these two modes infinitely fast. And that's something we don't want in our system. And this is called Zeno Phenomenon. And there's this whole thing called Type 1 Zeno and Type 2 Zeno, which is studied in the lectures. We're going to deal with Type 1 Zenoes, because we know how to deal with them. Type 2 Zenoes are tough, and we're not going to deal with them here, in this class at least. And an example is that, okay, you're given a system, right? This is a simple system here of two states, and you want to see if this guy here is Type 1 Zeno or not. And once again, just remember that this effect happens when you have, lets say, the same guard condition, but just flipped, right? So this was g1 and g2, it's possible that you did not keep going between the states really fast. But because it's the same condition here, g of x, which is less than 0, and then greater or equal to 0, that's the only way you get this surface g of x equal to 0, along which you're going to keep moving like this, right? Okay. So when is it going to be Type 1 Zeno? This is the first question you ask when you're designing a system here. And you have certain conditions for it. These are the conditions. Basically, what you want to see is that this is my surface g of x equal to 0. And when I'm hitting the surface from whichever direction I'm coming, either I'm coming from greater than equal to 0 or less than 0, right? Whichever condition I'm coming from, when I hit the surface does this particular equation hold true or not? Or does this particular condition hold true or not? Which is simply just saying that whenever I hit a surface, is it true that one mode, or f1 for example, is pulling me in one direction, and f2 is pulling me in the other direction? And that's encoded in this condition here. So it's not always true. So that's why you want to check when is it going to be true that I'm being pulled into different directions when I hit the surface, which is g of x equal to 0. Okay, so this is pretty simple. You guys saw the derivation in class, etc. And once this is true, or once you do determine that yes, it is a Type 1 Zeno, then what do you do? Okay, then you don't want to keep moving infinitely fast along the surface, right? What instead you want to do is you want to slide along the surface. So once we have found out that it is Type 1 Zeno, we're going to try and induce the sliding mode instead of going back and forth really fast so that, you know, we kind of remove this whole annoying thing with Zeno effect. So we have this example that we just saw. And now we want to find out, the first thing, is this in fact Type 1 Zeno or not, right? And we saw that we need to do this check to ensure if it's Type 1 Zeno or not. And this check is pretty simple, again g effect equal to 0, and then see if this condition holds or not, and we're going to do that. So we know g of x equal to 0 gives us x equal to 10, right? And then your lead derivative, Lf1g, is really nothing but the partial derivative of g with respect to x times f1. And because your g of x is x minus 10, your partial derivative of g with respect to x is going to be just 1 times f1, which is just f1. Which is 6 minus x, right? Okay. And now we want to make sure that our new derivative is negative, in the f1 direction, right? So in order to have this expression negative, we find now that our x must be greater than 6. In the same way, with the same math, you check out this condition, and it gives you x greater than 0. So you have these three things here: x is equal to 10, x greater than 6, x greater than 0. And you want to see if this makes sense or not. Will this situation ever occur, right? And it turns out, of course it will occur, because x equal to 10 automatically means x is greater than 6, and x is greater than 0. So that means when I hit the surface, I am in fact going to experience Zer, Zeno effect. So we have established that. Okay. So yeah, x is equal to 10. Kind of make sure of that. And that means that we must in fact do sliding control. Because once we hit the surface, we don't want to keep moving infinitely fast along that surface, we want to slide smoothly along the surface. So we have to do sliding control. Okay. So in general form, this is what it looks like. The thing is, once you find out that it is Type 1 Zeno, or that there will be Zeno effect, now what, right? You've hit the surface. You know that this is Zeno effect. Now what are you going to do? Now you need to move along that surface. But to move along that surface, you need to know the dynamics, right? You need to know x dot. How am I moving along the surface? So that's what this log diagram here shows. This guy in particular is the dynamics or the x dot that you employ in order to move along the surface. And the way you get this is by taking the time derivative of your guard condition, and setting it to 0. And the logic behind that is because you want to move on this line, gx equal to 0, obviously because you want to stay here where g is 0, you, you going to say that the time derivative of g is also 0. There's no change: g is going to stay constant at 0. And that's the whole intuition behind how you get x dot. The actual derivation is there in the lectures, so you guys can, you know, go refer to it and stuff. But I'm just giving you the formula here, and I'm telling you how you actually get it by setting dg by dt equal to zero. And okay, let's go back to the sliding mode dynamics and [COUGH] find them now. So we know that for this system, we already found out our guy is going to have Zeno effects, right? So now I'm going to find sliding mode dynamics by this equation right here. And there are two ways of doing it. One is pretty much what I told you, that I know it's going to be Type 1 Zeno, so I'm just going to set dg by dt equal to 0. And again, g of x is x minus 10. So dg by dt is going to really be just x dot, right? And then when I set x dot equal to 0, well guess what, I got my dynamics. So I means when I hit the sliding surface, I just stop; x dot is 0. I have no velocity. I have nothing. I pretty much just stop. Okay. But then, there's another way of doing it, if you don't want to go through this. And that's by pretty much solving it through this expression here. So you actually compute these little guys, the derivatives, which we have done, by the way, and plug them into this equation. And then you get x dot. So remember Lf1g was our f1. Lf2g was f2, so when you put this stuff into this guy, this becomes f2f1 minus f1f2, which is 0. And so you get x dot equal to 0. So both ways we saw that we can get our dynamics, x dot equal to 0. And that was really the whole point of this slide, to show you how, given a system, first you find out if it's Zeno Type 1 Zeno or not. Or let's say I tell you it's Type 1 Zeno, and then how do you find the sliding mode dynamics for it? So all together what happens is, okay, now I've got this new mode here, but I need to somehow connect it, right, to my initial system. So this is pretty simple. I know that when I hit the surface, I'm going to go into the sliding mode, whichever mode I'm in. When I'm transitioning, I hit x equal to 10. I come into the sliding mode, and then, of course, when I get out of it, the sliding mode, then I come back into my states. And if you're wondering, you know, how how do you come out of it well in this case x dot is 0, so maybe you're just going to grind to a halt. But there are times where, you know, your x dot is not 0. And you are continuously moving, but your condition, do you remember that Lf1g condition should be 0, less than 0, something else should be greater than 0. Basically vectors pointing opposite. So while moving, if at some point your vectors stop pointing opposite directions, or they start pointing in the same direction, etc, suddenly now you don't experience Zeno effect at that point, right? And that's how your dynamics are then going to just push you out off the sliding mode, and you're going to get out of it and then come back to these guys here. So this is just a general form of it. Okay? With that, keep checking the forums, good luck with Quiz 5, and bye-bye.