
This lecture gives you a guide for how to study the course in order to take the maximum value out of it.
This lecture explains how a controller uses the error between reference and tank volume to set the mass flow rate, with modern implementations as computer algorithms.
Explore the key differences between open loop and closed loop systems, highlighting how feedback from sensors and controllers adjusts input to achieve targets like mass flow rate and tank level.
A proportional controller multiplies the error by a gain to set the mass flow rate, steering the water tank toward the desired volume as the error approaches zero.
Learn how to approximate volume over time using numerical integration, applying the trapezoidal rule to update water volume with discrete time steps, mass flow rate, and density.
Explore a closed loop water tank system modeled in continuous and discrete mathematics. A proportional controller updates mass flow rate at 50 Hz to track changing volume references.
This video directs you to the PID simulation codes at the end of the first section and the NPC codes at the NPC coding section, and requests your feedback.
Translate acceleration into velocity and then position through numerical integration. Convert continuous equations to discrete form for implementation in code, using time steps and a water tank analogy.
A proportional controller converts position error into acceleration via kp, causing the train to overshoot and oscillate around the reference point as force aligns with the error.
Explain how a proportional controller yields zero acceleration at zero error, yet the train overshoots because velocity remains nonzero and the position keeps moving past the target.
Explain why a proportional controller cannot handle two integrators in a train model and how adding a derivative controller enables reaching the target position.
Explore the PID controller integral part and how gravity on an inclined rail yields normal and tangential components, balanced by normal force and motion via tangential component.
Move to a 45-degree incline to reveal the tangential component of gravity accelerates the train along the rails, and incorporate this component in magnet-induced force equations.
Explore Linux terminal, macOS terminal, and Windows command prompt to run Python files, navigate folders with cd and ls or dir, and master basic terminal commands.
Install python on Windows 11, add to path, test hello world, then install numpy, matplotlib, scipy, cvxopt, qp solvers, sympy, control, and moviepy for MPC and LQR in autonomous vehicles.
Install python 3.8.7 on macOS, test with a hello world script in the terminal, then install pip and numpy.
The lecture explains Python code for a pid train simulation that catches cubes on an inclined rail, detailing library imports, random positions, time arrays, and preallocated data structures.
Explain a Python multi-trial simulation with nested loops, computing PID error, derivative, and integral, applying force with gravity, and updating velocity and position via trapezoidal integration to get x and y.
Explore how to create Python animations with Matplotlib, build figures with subplots, define animated objects, and use FuncAnimation to visualize data over frames.
Explore how forces cause linear acceleration and moments cause rotation, define moment of inertia, and compare how mass distribution affects rotational resistance in objects.
Learn how forces at the center of mass cause translational motion without rotation, while forces away from the center create moments that rotate the rod.
The lecture shows how a bicycle model rotates about the center of mass, defines the longitudinal and lateral body frame, and describes velocity directions and the slip angle beta.
Derive the lateral equation of motion for a bicycle model, linking delta steering to lateral forces and moments, and showing how forces yield lateral acceleration and angular acceleration.
Derives centripetal acceleration for a turning vehicle, using v^2/R and a small slip-angle approximation to relate longitudinal velocity to angular velocity, then connects to vehicle dynamics.
Explore the centripetal acceleration in circular motion, deriving a_c = v^2 / r using calculus, with velocity and acceleration vectors, angular rate, and constant radius.
Explore rear wheel velocity in turning dynamics by relating center of mass motion to rear wheel angle, using a small angle approximation for easier controller design.
Transform the equations of motion and lateral forces into a vector-matrix form. Fill in the matrix and vector in the exercise to advance toward a state-space representation.
Identify states as the variables needed to describe a car's behavior, formulating open-loop state-based first-order differential equations with inputs, while keeping states minimal to capture lateral and angular dynamics.
Form state-based equations to simplify the open-loop box and compute state derivatives from initial states using the a-f constants. Update states every 0.1 seconds (10 hz) for the mpc loop.
Explain the open-loop state update algorithm using a single delta over a 0.1 s sample time, subdividing into five steps to compute intermediate states and derivatives, preparing for vector–matrix notation.
Put the system in vector-matrix form to enable model predictive control that minimizes error and delta changes, and compare embassy basic, robust, and non-linear variants with small-angle state-space assumptions.
Compare linear time invariant, linear time varying, and nonlinear state-space models by examining constant versus time varying A, B, C, and D matrices and their impact on outputs.
Learn model predictive control through a rocket lander example, predicting multiple steps ahead and tuning thrust to achieve a smooth zero-altitude landing via discrete horizon and error tracking.
Model predictive control selects a sequence of thrust levels from K to K plus five to land smoothly, minimizing a cost function that balances error and feasible thrust.
Model predictive control computes a sequence of thrust inputs from a cost function, discusses horizon length tradeoffs, and uses a receding-horizon loop to re-optimize after applying the first input.
Learn how model predictive control fuses sensor data and model predictions with a Kalman filter to counter sensor noise and uncertainty, and explore quadratic cost effects.
Explain why a quadratic cost function enables a well defined minimum in model predictive control, unlike linear or cubic forms, with positive weights and finite j_min.
Quadratic cost functions simplify finding the minimum: set the derivative to zero, use the second derivative to confirm a minimum, with positive weights giving minimum and negative weights indicating maximum.
Compute the gradient of multi-dimensional cost functions and set partial derivatives to zero to locate minima. Quadratic costs with positive weights guarantee the minimum; beware saddle points in higher dimensions.
Analyze a bicycle model that forms a continuous LTI system with four states and two outputs. Discretize x_{k+1}=A_d x_k + B_d u_k and y_k=C_d x_k + D_d u_k for MPC.
Explore how model predictive control predicts five future states using compact state space vectors, A and B matrices, and first-input optimization to guide autonomous car trajectories.
Learn how to reformulate the MPC cost function with a stronger last-sample weight, diagonal Q and R, and a single steering input in a bicycle model.
Augment the state space by adding the previous steering angle as a state. Model the system with tilde matrices and output tilde for MPC while minimizing cost.
Reframe the MPC error term as reference minus output using a state-space model with a five-step horizon, substituting the Cx terms, and shift inputs to steering deltas for smoother ride.
Expand the MPC cost function by treating inputs as delta steering wheel angles, augment the state, and show constant offsets do not affect the optimal solution.
Rewrite the cost function to depend only on input changes, embed state information in A and B, and derive the gradient to zero to obtain the optimal steering delta sequence.
Derive the gradient of a quadratic vector-matrix cost by treating loop constants, rewriting as f^T W, and showing gradient with respect to W equals the coefficient vector A1 through AD.
Take partial derivatives with respect to W_k, generalizing to any dimension, and reorganize terms to obtain the gradient vector for G(W)=W^T A W.
Derive the gradient of a quadratic vector-matrix form and show that for a symmetric matrix A, the gradient is A W plus F; explain the one-half cost cancellation.
Learn to use Linux Terminal, Mac OS Terminal, and Windows Command Prompt to run Python programs, navigate folders with cd, view files with less, and use tab completion.
Install the Python versions and matplotlib to run simulations, place two downloaded files in same folder, follow installation steps for Windows 10 and Mac OS, and analyze code and results.
Install Python on Windows 11 and configure essential libraries such as numpy, matplotlib, SciPy, Cvxopt, SymPy, and control to support mpc and autonomous vehicle projects.
Install Python 3.8 on Ubuntu 20.04, verify NumPy version, install pip and Matplotlib, and run the simulations from the Linux terminal or Windows command prompt.
Review how the course models a lane change with a bicycle model, lateral control, discrete lti form, and an mpc-style optimization for steering to track a trajectory.
Describe how the init function sets initial vehicle constants (mass, inertia, stiffness, geometry) and defines model predictive control matrices, stored in a reusable constants list for main and support files.
Learn how to generate the MPC cost function matrices for autonomous cars by building augmented A, B, C, D matrices and assembling Q, R, S blocks across the horizon.
This lecture explains the open loop new states function, updating the state vector with first derivatives using a 30-step oilor integrator methodology, based on the current state and steering input.
Learn how the code extracts optimal ci and big y values from the augmented state vector to plot horizon-five trajectories, and why it uses only the first control input.
This update precomputes the double bar and other matrices for the LTI system before the main loop, then regenerates them as the horizon shortens toward the end to speed execution.
The world is changing! The technology is changing! The advent of automation in our societies is spreading faster than anyone could have anticipated. At the forefront of our technological progress is autonomy in systems. Self driving cars and other autonomous vehicles are likely to be part of our every day lives. How would you like to understand and be able design these autonomous vehicles? How would you like to understand Mathematics behind it?
Welcome! In this course, you will be exposed to one of the most POWERFUL techniques there are, that are able to guide and control systems precisely and reliably.
You are going to DESIGN, MASTER and APPLY:
mathematical models in the form of state-space systems and equations of motion
a PID controller to a simple magnetic train that needs to catch objects that randomly fall from the sky
a Model Predictive Controller (MPC) to an autonomous car in a simple lane changing maneuver on a straight road at a constant forward speed.
You will LEARN the fundamentals and the logic of Modelling, PID and MPC that will allow you to apply it to other systems you might encounter in the future.
You need 3 things when solving an Engineering problem: INTUITION, MATHEMATICS, CODING! You can't choose - you really need them all. After this course, you will master Modelling, PID and MPC in all these 3 ways. That's a promise!
I'm very excited to have you in my course and I can't wait to teach you what I know.
Let's get started!