Now to look at a concrete setting, let's discuss the problem of designing a minimum jerk trajectory, which again, makes sense if you have a third order system. And let's assume that we're specified the starting position and the end position. Our functional is simply the integral of the square of the jerk and we want to find the best x of t that minimizes this functional. We write down the Euler Lagrange equations and we see that a whole bunch of terms just disappear because they don't explicitly depend on x triple dot. What remains can be simplified into the sixth order differential equation. Which then can be solved analytically and the result is this fifth order polynomial in time. What remains is the sub problem of solving for the coefficients in this fifth order polynomial. There are six such coefficients. In order to solve for these, you need to specify additional boundary conditions. We've assumed that we know the position at the start position and the end position. Now let's also assume that we know the velocities and in this case I'll just assume that these velocities are zero. In addition, let's assume we know the accelerations, and again assuming these accelerations are zero. The main goal of this exercise is to ensure that you have as many boundary conditions as the constants you're trying to solve for. Each of these boundary conditions gives you an equation. You can write down six equations in terms of the unknown constants and in terms of the known boundary conditions. Solving for these constants is now a linear problem. This is what the minimum jerk solution looks like. For this particular case, we've taken x starting from zero and ending up at one, taking a total of fifty time units. The velocity profile is bell shaped starting off with a zero velocity, ending with a zero velocity. It's uni modal reaching a peak velocity in the middle. And the acceleration looks. Again starting off with a zero acceleration, reaching a peak acceleration. And then going all the way down to a peak deceleration and then ending up at zero. This basic idea can be extended to multiple dimensions. If you're trying to generate trajectories in the x, y plane, then you end up at two Euler Lagrange equations. One for the x direction and one for the y direction. And here's how you might think about the minimum jerk trajectory in three dimensions. Here we're looking at a trajectory in the x, y, and theta space. We're assuming we're given a starting x and y position. And a starting orientation theta. And we're given a final x, y, and theta. We're trying to find a trajectory that minimizes the functional that is given by x triple dot squared plus y triple dot squared plus theta triple dot squared. If I use the version of the Euler Lagrange equations for multiple dimensions, I end up with a very straightforward solution. I essentially get three fifth order polynomials. One in the x direction, one in the y and then one in the theta direction. By plugging in the boundary conditions, I get the plots that you see on the right-hand side. You see the starting position orientation and the end position and orientation and a smooth transition from the start to the end. And a velocity profile that's once again bell shaped. It turns out that this particular problem is also relevant to modeling human manipulation tasks. This literature goes back to 1985 to a doctoral dissertation by Tamar Flash. And can be extended to multiple dimensions if you consider two-handed manipulation tasks. But we turn back now to our problem in robotics. In robotics, it's not sufficient to specify just the initial and final position in orientation. In order to ensure that the trajectory is safe you might want to specify intermediate waypoints. Instead of thinking simply about trajectories with known starting and end configurations, we want to think about trajectories that pass through intermediate rate points. So, let's consider the problem, we are given a set of intermediate time points and positions that your require the trajectory to pass through. So, these time point at t zero t one etc. And the corresponding positions are x zero x one etc. In this case, we have assumed that n plus one time points and m plus one corresponding positions A simple way to approach this is define piecewise continuous trajectories, one for each time segment. The obvious way of doing it is to simply connect the waypoints. But this is not very practical. Word of the system is a second order system, with inertia. Once you get started on the first segment, it's impossible for a second order system to make the sharp turn at the kink. In order to make the trajectory more amenable to a second order system, you want to insist that the trajectory is smooth and not have this kink that you see in the intermediate time points. To see how to solve this problem, let's look at a minimum acceleration curve for second order systems. We look at the problem of solving for this function, x of t. But now, the function now, consists of many terms, each term corresponds to a particular segment. From the Euler Lagrange equations, if we solve this, we'll find that we get cubic for each segment. The resulting function or curve is called a cubic spline. So, we now know the functional of form of each segment. However, we don't have the constants. You'll see that there are four m constants for this cubic spline. Each of these constants corresponds to a degree of freedom. In order to determine these constants, we have to specify four m different boundary conditions or intermediate conditions. Going back to our schematic, we're looking for a smooth curve. We know where these intermediate points are. And that gives us two m boundary conditions. We further insist that the curve is smooth. More specifically, differentiable up to two times at each of these intermediate points. That gives us an additional two times m minus one boundary conditions. And then, finally, we insist that the curve starts with a specified velocity and ends with a specified velocity. In this case, that velocity is taken to be zero. That gives us an additional two boundary conditions. If I add these up, I get four m constraints allowing me to specify the four m degrees of freedom associated with the undetermined constants. This basic idea can be generalized to nth order systems. We have to specify appropriate boundary conditions in the beginning and in the end. And we have to specify intermediate boundary conditions. And these intermediate boundary conditions, specify continuity up to the two times n minus one order derivetor. This leads us to minimum snap trajectories where n is equal to four. We're now ready to solve the motion planning problem for quadrotors using minimum snap trajectories.