QuadcopterControl

Code

Drake is an extremely powerful tool as a simulator and for designing controls algorithms. This project aims to familiarize myself with it through developing the popular nonlinear trajectory optimization strategy, iterated Linear Quadratic Regulator (iLQR), for directly providing motor commands to stabilize to a desired state. In doing so, I have also delved into quaternion dynamics, a significantly more robust, but slightly more complicated, alternative to euler angles. In the attached repository, I present my implementation of iLQR in python with examples of use with a car, acrobot, and quadrotor. The user only need design a model of the plant that provides dynamics, cost, and derivative information to utilize the controller. For an example of how this controller specifically handles quaternion dynamics, refer to control/models/Quadrotor_Quat.py, where a model of the quadrotor has been written using CasADi with special consideration towards quaternions.

iLQR for a car:

ilqr of a car

iLQR for the Acrobot

ilqr of a acrobot

iLQR for a Quadcopter using quaternion dynamics

The following demonstrates a quadrotor initialized with high velocity, and large difference in orientation from the goal state. The specific chosen orientation is near a singularity for a roll pitch yaw representation, allowing quaternions to prove their use here. The high velocity and awkward orientation force the controller to reason through fairly nonlinear dynamics, eliminating the potential for LQR to handle this situation. ilqr of a quadcopter