This repository provides the implementation of a Model Predictive Control (MPC) architecture designed for the reliable control of unmanned aerial vehicles (UAVs). It is part of the Master's thesis "Design and Implementation of a Model Predictive Control Architecture for Dependable Control of Unmanned Aerial Vehicles" by Frederik Schmittel.
-
Model Predictive Control (MPC)
- Custom ADMM-based solver for optimal control computation
- Real-time constraint handling to ensure system safety
-
State Estimation
- Luenberger Observer for Robust State Estimation
- Estimates system states without noise influence
- Real-time state prediction and correction
- Luenberger Observer for Robust State Estimation
- Predictive Safety Filter
- Proactively enforces constraints to ensure safe operation
- Real-time validation of control inputs
- Automatic fallback to a backup control input in case of constraint violations
-
ROS2 Integration
- Modular, node-based system architecture
- Efficient inter-process communication through ROS2 topics
- Zero-copy data transfer where applicable to minimize latency
-
High-Performance Computing
- Optimized matrix operations for real-time execution
- Cache-friendly data structures to enhance computational efficiency
- Minimization of dynamic memory allocation for improved determinism
The system consists of three main components working together to ensure safe and optimal control of a dynamic system.
graph TD
A[System Simulator] -->|Measurements| B[State Observer]
B -->|State Estimate| C[MPC Controller]
C -->|Control Commands| D[Safety Filter]
D -->|Safe Controls| A
- Simulates linearized UAV dynamics
- Provides sensor measurements
- Applies control inputs
- Real-time system state updates
- Implements predictive safety filtering
- Validates control constraints
- Ensures state bounds
- Provides backup control strategies
- Executes MPC optimization
- Performs state estimation
- Computes optimal control inputs
- Handles real-time constraints
- Control loop frequency: 50Hz
- State dimension: 8 (position, velocity, orientation)
- Control inputs: 4 (motor commands)
- Constraint validation: <1ms
- MPC solve time: ~5ms average
- Docker
- Git
- ROS2 Humble (if building from source)
# Clone repository
git clone https://github.com/F-DSK-SCH/ros2_dependable_mpc.git
cd ros2_dependable_mpc
# Build Docker image
docker build -t ros2_dependable_mpc .
# Run simulation
docker run --rm ros2_dependable_mpc ros2 launch mpc_package control_loop_launch.py# Install dependencies
sudo apt-get update && sudo apt-get install -y \\
python3-pip \\
python3-colcon-common-extensions \\
libeigen3-dev
# Build project
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/F-DSK-SCH/ros2_dependable_mpc.git
cd ..
colcon build
source install/setup.bash
# Run simulation
ros2 launch mpc_package control_loop_launch.pyThe system can be configured through YAML files:
controller:
ros__parameters:
# System dynamics matrix (8x8)
SYSTEM_MATRIX: [
1.0, 0.0, -0.0001, ...
# ... rest of matrix
]
# Input matrix (8x4)
INPUT_MATRIX: [
0.0, -0.0065, ...
# ... rest of matrix
]
# Control constraints
CONTROL_MAX: [0.43633, 0.34907, 0.52360, 0.75]
CONTROL_MIN: [-0.43633, -0.34907, -0.52360, 0.0]This project is licensed under the MIT License - see the LICENSE file for details.
This work is part of the Master's thesis "Design and implementation of a model predictive control architecture for dependable control of unmanned aerial vehicles" by Frederik Schmittel.
Project Link: https://github.com/F-DSK-SCH/dependable_mpc