This project demonstrates a robust localization and control system for a differential drive robot within a PyBullet simulation environment using:
- Model Predictive Control (MPC) for real-time trajectory tracking and stabilization.
- Extended Kalman Filter (EKF) for accurate state estimation under noisy sensor conditions.
Integrating MPC with EKF enables the robot to navigate reliably to target positions while filtering out sensor noise, making the system suitable for real-world applications.
The robot's goal is to reach and stabilize around a predefined target position. Key components of this setup include:
- MPC Controller: Determines optimal control actions to minimize trajectory deviation while satisfying physical constraints.
- EKF Estimator: Estimates the robot’s position and orientation by filtering noisy sensor data, which is then used by the MPC for enhanced control accuracy.
A Differential Drive Kinematic Model simulates the robot’s movement based on wheel velocities, helping to predict its position over time.
- State Estimation with EKF: The EKF continuously updates the robot's estimated state (position and orientation) based on noisy range-bearing measurements. It predicts the state in each timestep, corrects it with incoming sensor data, and provides this estimated state to the MPC.
- Trajectory Control with MPC: Given the EKF’s estimated state, the MPC calculates optimal control inputs (e.g., linear and angular velocities) to guide the robot towards the target. The MPC minimizes target deviation while accounting for the robot’s constraints and avoiding overshoot.
- Real-Time Feedback Loop: The EKF’s estimates feed continuously into the MPC, creating a feedback loop that enables the robot to adapt to changing conditions and noisy data.
This project was implemented within a virtual environment, "RoboEnv," provided by the University College London teaching team. As this environment was used for both coursework and assessment, it is not included in this repository. However, it can be found publicly on GitHub here.
If you wish to run this project and the repository is still accessible, you will need to:
- Set up the RoboEnv environment.
- Place the
modelsandconfigsfolders in the project's running directory. - Run:
python differential_drive_ekf.py
This repository includes only the code files that implement the core MPC and EKF logic necessary for robotic simulation.
Below are the simulation results under different conditions.
-
MPC without EKF (Noise-Free): The robot starts at (2, 3) and attempts to stabilize at the target (0, 0) using only the MPC controller in a noise-free environment.
-
MPC without EKF (With Noise): The same configuration is simulated, but with added sensor noise.
Under noise, the robot's navigation becomes erratic, highlighting the need for robust estimation.
-
MPC with EKF (With Noise): Adding the EKF significantly improves the robot's ability to track the target path under noisy conditions.
Using 20 landmarks in a square boundary, the robot successfully reaches the goal with improved trajectory estimation.
-
Testing with Various Starting Points: Different initial positions were used to test robustness.
Evaluation metrics for various starting points, including steady-state error, overshoot, and settling time, are shown below:
Overall, these results demonstrate that integrating an EKF with MPC significantly enhances localization and control robustness under noisy conditions.
This project is licensed under the GNU GENERAL PUBLIC LICENSE v3.0. See the LICENSE file for more details.
- This project was developed as part of the assessment for the COMP0242 - Estimation and Control module at University College London.
- It was a collaborative effort by myself, @ethandsz, and @lorenzouttini.
- Special thanks to the teaching team for providing the simulation environment and guidance throughout the project.





