0:00

So in the previous lecture, we saw that switches show up very naturally,

Â especially in robotics where we're going to switch between different modes of

Â operation. And what I want to do today is talk a

Â little bit about the models that we're going to use to describe these phenomena.

Â And the models that we're going to use are called Hybrid Automata.

Â And these are models that contain both the continuous dynamics.

Â Meaning to x dot part and the discrete switching logic that says oh, if you see

Â an obstacle you should switch to an obstacle avoidance behavior, or something

Â like that. Now, what this means is that the discrete

Â logic will be modeled as a finite state machine that moves between different

Â discrete states, so that's the discrete logic.

Â But just a finite state machine on static steroids in the sense that inside each

Â state we have a continuous dynamics loraking so.

Â Having said that, what we need first of all is the notion of a state.

Â So x, as before, is the continuous state of the system.

Â This is the physical state typically of what a robot is doing.

Â But then what we're going to do is we're going to add a discrete state that I'm

Â going to call q. And q is going to tell me which different

Â continuous mode I am in. So my dynamics now can be encoded not As

Â xdot=f(x,u) but xdot=fsubq(x,u). Where this q now tells me which mode am I

Â actually in. And what we're going to do is transition

Â between different discrete modes in a state machine where here I'm having mode

Â q. So really, xdot inside that mode.

Â Is going to, be fsubq and xdot inside this mode is going to be xdot is, fsubq

Â prime. Now, these are called transitions right,

Â so when you jump in between different discrete modes you're making transitions

Â between different states in the finite state machine.

Â Now what we need to understand is, when do we actually make these Jumps, well for

Â that we need something called a guard and the guard is something that checks

Â whether or not you should jump. And then we're also, [COUGH], excuse me,

Â also going to add something else which is called a reset which is going to tell you

Â not when you jump but where you end up after you made the transition.

Â So the guard condition is a condition that tells you when it is time to jump.

Â So let's say that I am in mode q and I want to jump to mode q prime.

Â Well, what I have, is I have a guard that says, if.

Â x belongs to this guard, let's say that this is, I'm going to switch from one

Â gear to another gear if my rpm is above 3,000 then I'm going to switch.

Â This is a guard condition that encodes when it is time to jump.

Â Now, when I'm jumping I may actually reset the value of my state.

Â For instance, if I'm dropping a ball, whoop, onto this desk, and it bounces up,

Â it loses energy in, in the bounce so what we're doing is we're subtracting a piece

Â away from the state. At each bounce.

Â This way of messing with the state at the moment the transitions occur is called a

Â reset. So, if I am going, I'm here in mode q.

Â 3:19

[SOUND]. And then my guard is true, so I am moving

Â to q prime. Well, what's happening here is that x

Â changes for instance, x is now lets say, the old x/5.

Â That would be a guard that says, oh I'm getting only a fifth of the energy

Â somehow after this jump. So, what we need are dynamics, individual

Â dynamics which are called modes. We need transitions which tell us, tells

Â us which discrete states are we moving in between.

Â We need guards which tell us When we're going to make these jumps and we're, need

Â resets to tell us how these jumps end up effecting the state.

Â So if we put all of this together, we get a rather arguably messy looking thing.

Â But it's very rich. This is the hybrid automaton.

Â Singular, or hybrid automata, plural model. And the way this works is, let's

Â see here, we start with x equal to x not, we end up in this mode, which is q=1,

Â where we are evolving according to this differential equation.

Â Right? Okay, if in this case, x belongs to G12, then x, we're going to move, over

Â into this mode. And on our way. We're going to reset the state.

Â Now the state is here. This is my dynamics.

Â I'm in q2 mode. Well if, G21 becomes true, I jump this

Â way. But if G23 becomes true, I jump that way.

Â So let's say G23 became true, I jump this way.

Â I change my state, possibly according to this reset map.

Â I have a third dynamics, q=3. And then when x enters G31 guard, it

Â jumps back into q=1, with a new possible reset.

Â So this is the general model that we're going to work with.

Â Now, it looks a little bit messy, but it's actually really not.

Â In most cases, these models are going to look rather, innocent.

Â So, here's for example, a very very simple Hybrid system.

Â it's a thermostat, or it's my idea of a thermostat.

Â Typically, the way a thermostat works, at least cheap ones, is you set some

Â temperature you would like. The thermostat is on the heater is on

Â until you reach that temperature, or typically, go a little bit above it.

Â And then, it turns off, and then you cool down, and then, when you're too low, you

Â turn it on again. And you've heard this all.

Â In buildings with, with heaters, or that turn on and off.

Â So, what we're doing is, we're heating it up until we're comfortable and warm.

Â And in fact, this is my desired temperature and you typically want to add

Â a little slack that says that I'm going to, shut this thing off when I'm at,

Â whatever I want to be 70 degrees. Plus a little slack, let's say.

Â By the way, this is 70 degrees Fahrenheit.

Â For you Celsius people out there, let's say it's 20.

Â so now, we're above 20 Celsius, and now we're going to cool it down.

Â And then we're cooling it down until we're,in this case, below, well, 20

Â degrees Celsius, or whatever it is in Fahrenheit, - epsilon.

Â And the reason why we need this epsilon is.

Â If we didn't have it, then this guard is true.

Â And this is guard is immediately true. 'Cuz if t is = to t desired, we're just

Â going to start spinning around indefinitely here.

Â So, the little epsilons are important. So, this would be 1 way.

Â In which we will model a thermostat. There are no resets here just current

Â conditions because we're not magically making the temperature jump just because

Â we're changing the heaters from, from on to off.

Â Well, here's a gear shifter, right Well, we have some dynamics.

Â v is the velocity of the car. We're now in first gear.

Â This is our dynamics. u is our smashing the break of the gas

Â pedal down. So this is how we are driving.

Â When we have the RPM above some threshold then we change gears.

Â We switch up to second gear which is here, right.

Â So now we are having the second gear. If we keep pressing the gas.

Â So that the RPM goes up beyond, beyond some c2, then we switch to third gear.

Â Apparently this car only has three gears. but, we go to the third gear, and the

Â same thing here with a downshift. And note this here that I have c2 prime

Â and c1 prime. And c1 and c2 here.

Â This is again, because you want to build in a little bit of slack.

Â This is my way of hiding an epsilon inside there so we don't immediately

Â transition between, between gears. So this would be a hybrid atomaton gear

Â shifter. And I'm not writing out these dynamics.

Â Because the particulars aren't that important right now.

Â The important thing is, the switching logic and the way the guards operate.

Â Well finally, let's look at the behavior-based robotics system.

Â What I'm doing is I'm running the robot. So let's say at x is the position of the

Â robot. According to a go to goal behavior.

Â So f go to goal of x. This is me having to assign that.

Â When the distance between where I am and where the closest obstacle is when that's

Â less than some sum d, meaning I'm too close to an obstacle, then I'm going to

Â switch to another mode or another behavior which is Avoid obstacles.

Â So now I have decide my avoid obstacle behavior and it's safely taking me away

Â from the obstacle and then when the position of the robot is greater than

Â some other distance, the prime away from the obstacle then I switched to goal to

Â goal again. And the way this would look is, let's say

Â here's the obstacle. Here's the goal.

Â Here's my robot. [SOUND].

Â My robot is doing fine. Here's the ball of radius d.

Â Once I get in here, I'm going to switch to a goal to goal behavior.

Â That's going to take me away from the robot.

Â Let's say here is a larger circle of radius d prime and when I'm here, I'm

Â going to be safe and I'm going to switch to goal to goal behavior.

Â So this is what would happen in practice if you ran this hybrid atomaton as a

Â behavior based robotic system. Now, unfortunately, things aren't all

Â rosy in the hybrid world. And what we'll see in the next lecture is

Â that things may actually go wrong even the we are meaning very well when we

Â start building our systems. So the next lecture is a Danger:Beware

Â sign that we need to put up whenever we are designing hybrid systems, as opposed

Â to standard standalone linear time and variant systems.

Â