Control systems form the basis for ensuring that every automatic system performs its ordained task accurately, efficiently and quickly (optimally) despite being subjected to varying environmental conditions.
In this project, we explore one of these control systems, i.e., LQR (Linear Quadratic Regulator) Controller, which is a type of controller in which we try to minimise a cost function by optimising the various factors involved in the physical system. Then, we apply LQR to the classical problem of an Inverted Pendulum on Rails, which is used as a benchmark for testing control strategies, both in simulation and hardware.
- Linear Algebra, for representation of various aspects of physical systems, like, current state, stability, etc.. (Notes for the same)
- A thorough understanding of Control Systems. (Notes for the same)
- GNU Octave, version 7.1.0 for modelling and simulation of inverted pendulum.
- SOLIDWORKS, for designing custom components.
- Embedded C
- NEMA-17 Stepper Motor (Notes for the same)
- DRV8825 Motor Driver
- Rails, on which the cart moves
- Timing belt
- Custom-designed laser-cut cart, made of acrylic, and has screw-holes for the wheels (bearings) (Drawing file for the plates)
- ESP32 microcontroller
- MPU6050, the IMU used for measuring the deviation of the pendulum from the normal
- 9 bearings
- 8 in the cart (acting as wheels)
- 1 inserted in the pendulum
- Pendulum rod, having comparable weight to the cart
We first model the physical system by considering it's parameters (like mass of cart, pendulum rod, length of rod, etc.) and the dynamics equations.
Then, we linearise the system about it's equilibrium point,
For the linearised system, we then define the system using the 'ss()' function. Using the 'c2d()' function, we discretise the system, and then we get the feedback matrix K, by using the function 'dlqr()'. Octave File for reference
The input,
Using the 'step()' function, this is the plot generated for the step response of the linearised system in terms of the state variables, i.e.,
First, we used the rails which were part of a CNC machine, and were firmly held in place. Then, the cart, fitted with the bearings, is then places around the rails. The stepper motor and the free pulley are mounted aside the rails, and both of which drive a timing belt, which itself drives the cart. The MPU6050 is mounted on the rod, with the help of screws, near the pivot point. The rod itself contains a bearing, which allows it to rotate about the screw. The screw is held in place on the cart by means of a mount.
These are some of the issues we faced during the setup and testing process of the system, along with their solutions.
This is one of our best runs:
WhatsApp.Video.2022-10-14.at.17.24.47.mp4
- Improve balancing
- Add swing up controller
- Implement LQR on self-balancing bot on wheels
- SRA VJTI
- Special Thanks to our mentors Jash Shah, Ayush Kaura and Chinmay Lonkar
- Linear Algebra playlist by 3Blue1Brown
- Control Bootcamp playlist by Steve Brunton
- https://docs.espressif.com/projects/esp-idf/en/latest/esp32/
- https://newscrewdriver.com/2021/02/25/esp32-exercise-stepper-motor-pulses-with-ledc-pwm/