Building your own wheeled vehicles brings challenges you might not anticipate from observing other vehicles. In this project, you learn to surmount a common problem in vehicles using independent wheel control – how to reduce variance in the vehicle header to apply the same power to each wheel.
In this project, you learn how to implement a closed-loop control algorithm in MATLAB® to straighten the drive of a two-wheeled LEGO® MINDSTORMS® EV3 vehicle.
In a vehicle using independent wheel control, applying the same power to each wheel generally doesn’t make the vehicle move in a straight line. Each wheel experiences mechanical and surface differences. To reduce deviation in the vehicle heading, a better approach is to use a closed-loop controller, which adjusts the power applied to two motors based on difference in their rotations. A good controller to use is the proportional-integral-derivative or PID controller.
PID control is a basic control loop feedback mechanism. The controller minimizes the difference between the measured and desired value of a chosen system variable by adjusting the system control inputs. This project demonstrates the control algorithm implementations, first with no feedback control (open-loop control), and then with feedback control (closed-loop control) based on a P controller.
Before you get started, review these examples to learn about support in MATLAB for LEGO MINDSTORMS EV3:
- Getting Started with MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware
- Interacting with EV3 Brick Peripherals, Read Sensor Values, and Control Motors