Quadruped robot with MPC controller

Early 2021
This is a quadruped robot that is capable of controlling all the degrees of freedom at the same time because it runs on a more advanced MPC controller. The controller is designed based on the MIT Cheetah 3 paper. The controller runs on a Raspberry Pi 4 computer which controls the 12 servos. The actual robot performs worse than the simulation because the servos, being only $2 each, have a poor performance in faithfully controlling the positions. They even require rubber bands to hold the weight of the robot. The next generation of this robot will use better servos and will hopefully have a similar performance to the simulation.



The dragoon works, but it is limited. The controller runs on a record-and-replay basis, and therefore it is not able to control multiple degrees of freedom a the same time, otherwise, the recording file size will increase drastically. A better controller is thus required to solve this issue. After taking ME 292B, Introduction to Legged Robotics, at UC Berkeley, I decided that MPC (Model Predictive Control) is an ideal controller to achieve the purpose of stably controlling multiple degrees of freedom at once.



The Immortal is essentially a bigger version of the Dragoon. It has the same overall architecture as the Dragoon but has a larger metal chassis, and more powerful servos (MG946R). The battery and computer are placed at the center of the robot. Since MPC is likely to require a lot more computing power, I used a Raspberry Pi 4 as the central computer.



The controller is built with strong reference to the MIT Cheetah 3 controller discussed in the paper. The dynamics is replaced with the one that reflects that of a spider-type robot. The output of the controller is no longer joint torques, but joint angles, as the servos are position devices. The controller code is written in MATLAB since it is likely to be very complicated in C/C++ if coded directly.



The controller is verified by running a simulation in MATLAB. The simulation shows that the robot is able to control multiple degrees of freedom, and the walking gait looks reasonable.



To make the controller run on Raspberry Pi 4, the MATLAB code has to be converted into C. I used MATLAB Coder to do the conversion. Everything works well except for the convex optimization solver, which MATLAB Coder is not able to convert into C. I then searched for convex optimization solvers and found the CVXGEN by Stanford is the most efficient and easy-to-use one, which I have decided to implement on my robot. Overall, the controller works by first listening to a remote/keyboard for user inputs, converting the inputs into an optimization problem, sending the optimization problem for the CVXGEN solver to solve, and finally mapping the solutions into joint angle commands which are then sent to the servos.


Spider mode

Finally, the hardware is set up to test the controller. It turns out that the servos are too bad that they can barely support the weight of the robot. I then added rubber bands to assist the actuators. They did help a lot in getting the robot to move, but the speed still has to be very small or the arms will collapse. In the end, I decided to change the configuration into that of a dog as I believed the dog configuration is more ideal for robotic locomotion and requires less torque on the actuators.


Dog mode

It turns out that switching to the dog configuration does not really solve the problem. The actuators are still too bad in terms of tracking the commanded trajectory. In the end, I decided to build a new quadruped robot with a more powerful digital servo, DS3225MG, and make several upgrades to it.