Portfolio

Inverted Pendulum

This is a classic textbook Controls problem where a single actuator (motor) introduces a horizontal force to a cart to keep the pendulum from falling as well as centering the cart. A full state feedback controller designed with pole placement was implemented on an XMEGA 128A4U microprocessor using FREERTOS in C++.

Additional inverted pendulum photo

ML: Ball Balancing on Plate

The objective with this robot was to keep the ping pong ball centered by commanding a tilt of the plate in two directions, which then gets converted to motor arm angles with inverse kinematics. Two PID controllers was initially implemented, but I created the spotlight demonstration of training a Reinforcement Learning (RL) algorithm called PPO in simulation to then deploy on the hardware.

Master's Thesis: Backing Up a Trailer

A Linear Quadratic Tracker (LQR) controller was compared to a Reinforcement Learning (DDPG) policy for the task of backing up a truck and trailer to a loading dock by steering to follow a reference path provided in simulation. The system is unstable open loop and has the three states of the heading (angle) of the truck, heading of the trailer, and the lateral position of the trailer axle to the reference path. Using these controllers stabilize the system where the LQR had more precision, but the DDPG could impose non-linear constraints like preventing jack-knifing.

Additional inverted pendulum photo

Emergency Braking System - FSD

Formula Student Driverless (FSD) 2017 was a competition in Hockenheimring, Germany where Autonomous Vehicle (AV) equipment was retrofitted on previous year cars to compete in Track Drive, Acceleration, and Skidpad through cones without a driver. The team utilized a differential GPS that was accurate to +-2cm and cameras with object detection to achieve a speed of 50kmh. The design judges praised my design for the normally closed circuit of the emergency brake pedal which had gas springs and released the pedal using a pneumatic actuator.

Formula SAE

Acting as the Technical Director in 2015-2016, I used vehicle dynamics to design, build, and test both our Combustion and Electric cars with a team. I pushed for decreasing wheelbase and packaging the powertrain accordingly after lap simulations. At Michigan 2016's collegiate competition, we placed 1st in Efficiency and 6th in Endurance.

Model Predictive Control (MPC)

MPC is an optimal controller that utilizes a discrete state space model of a system to do convex optimization with a cost function, J, over a finite horizon. Each timestep, MPC will get N actions for the horizon that is selected and typically only the first action is utilized. The system below is for the same truck and trailer as my Master's thesis. Although this is computationally expensive, it does allow imposing constraints like jack-knifing.

xk+1=Axk+Bukx_{k+1} = A\, x_k + B\, u_k
[x1x2x3]=[AA2A3]x0+[B00ABB0A2BABB][u0u1u2]\begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ \vdots \end{bmatrix} = \begin{bmatrix} A \\ A^2 \\ A^3 \\ \vdots \end{bmatrix} x_0 + \begin{bmatrix} B & 0 & 0 & \cdots \\ AB & B & 0 & \cdots \\ A^2B & AB & B & \cdots \\ \vdots & \vdots & \vdots & \ddots \end{bmatrix} \begin{bmatrix} u_0 \\ u_1 \\ u_2 \\ \vdots \end{bmatrix}
xˉ=Aˉx0+Bˉuˉ\bar{x} = \bar{A}\, x_0 + \bar{B}\, \bar{u}
J=k=0N1[xkTQxk+ukTRuk]+xNTPxNJ = \sum_{k=0}^{N-1} \left[ x_k^T Q\, x_k + u_k^T R\, u_k \right] + x_N^T P\, x_N
J=x0TQx0+[x1Tx2Tx3T]+[Q000Q000Q][x1x2x3]+[R000R000R][u0u1u2]J = x_0^T Q\, x_0 + \begin{bmatrix} x_1^{T} & x_2^{T} & x_3^{T} & \cdots \end{bmatrix} + \begin{bmatrix} Q & 0 & 0 & \cdots \\ 0 & Q & 0 & \cdots \\ 0 & 0 & Q & \cdots \\ \vdots & \vdots & \vdots & \ddots \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ \vdots \end{bmatrix} + \begin{bmatrix} R & 0 & 0 & \cdots \\ 0 & R & 0 & \cdots \\ 0 & 0 & R & \cdots \\ \vdots & \vdots & \vdots & \ddots \end{bmatrix} \begin{bmatrix} u_0 \\ u_1 \\ u_2 \\ \vdots \end{bmatrix}
J=xˉTQˉxˉ+uˉTRˉuˉJ = \bar{x}^{T}\bar{Q}\bar{x} + \bar{u}^{T}\bar{R}\bar{u}

Plug in xˉ\bar{x} into JJ and solve for uˉ\bar{u} with constraints

MPC subplot results

Kalman Filter

Half the battle of Controls is getting reliable signal information. Quadrature encoders were used for measuring my pendulum angle in the inverted pendulum, but it is not reliable at low speeds when trying to convert the signal to SI units because one tick will result in a step change--which is especially bad for velocity calculations. A Kalman Filter is a state estimator that uses a discrete system to predict the states considering process noise and measurement noise. You can see in θ˙\dot{\theta} the Kalman filter smooths the estimate out.

Prediction Step

x^kk1=Fx^k1k1+Guk\hat{x}_{k|k-1} = F\, \hat{x}_{k-1|k-1} + G\, u_k
Pkk1=FPk1k1FT+QP_{k|k-1} = F\, P_{k-1|k-1}\, F^T + Q

Update Step

Kk=Pkk1HT(HPkk1HT+R)1K_k = P_{k|k-1}\, H^T \left( H\, P_{k|k-1}\, H^T + R \right)^{-1}
x^kk=x^kk1+Kk(zkHx^kk1)\hat{x}_{k|k} = \hat{x}_{k|k-1} + K_k \left( z_k - H\, \hat{x}_{k|k-1} \right)
Pkk=(IKkH)Pkk1(IKkH)T+KkRnKnTP_{k|k} = \left( I - K_k\, H \right) P_{k|k-1} \left( I - K_k\, H \right)^T + K_k\,R_n\,K^T_n
Kalman Filter subplot results

A* Path Planning

Given a start location and end goal, you can use A* to find the optimal path between the two considering obstacles in a discretized space. A* builds on top of Dijkstra's algorithm by using a heuristic with a priority queue ranked on distance to the goal position. I implemented this in C++ with a node class to help build a discretized graph where neighbors could be checked.

A* plot