一个基于ACADOS的非线性模型预测控制器(NMPC),用于四旋翼飞行器跟踪圆形轨迹并保持偏航指向地面静止目标,具备Python到C++的完整流水线以及有意的模型失配鲁棒性测试。

Stars

38

7 天增长

暂无数据

Fork 数

4

开放 Issue

0

开源协议

暂无数据

最近更新

2026-07-27

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

该项目提供了一个从Python (CasADi) 符号模型定义到编译C求解器的完整、可复现流水线,通过MPC预测器与植物模拟器之间的模型失配明确测试鲁棒性,并采用单位向量表示偏航以规避角度缠绕问题。

适合谁使用

  • 四旋翼控制研究人员
  • 在嵌入式系统上实现MPC的机器人工程师
  • 学习非线性模型预测控制的学生
  • 将ACADOS集成到实时应用的开发者

典型使用场景

  • 圆形轨迹跟踪同时保持相机朝向中心目标
  • 在模型失配条件下基准测试MPC性能
  • 端到端NMPC代码生成与部署的教学
  • 快速原型设计感知感知控制策略

项目优势

  • 物理模型(ODE)与控制设计(代价/约束)清晰分离于不同脚本
  • 鲁棒性验证:植物使用二阶动力学而MPC使用一阶近似
  • 在代价函数中采用单位向量表示偏航,自然处理角度缠绕
  • 单命令流水线(run.sh)自动完成代码生成、编译、模拟和可视化

使用前须知

  • 一阶内环滞后是近似,并非PX4精确的二阶动力学
  • 欧拉角在θ=±90°处存在奇异性,故俯仰角限制在±60°
  • 需要手动安装ACADOS并依赖固定路径(~/acados)

README 快速开始

Argus — Quadrotor Target-Tracking MPC

Model Predictive Control for a quadrotor tracking a circular trajectory with yaw locked toward an object at the centre. The controller is formulated as a Nonlinear MPC using ACADOS, which generates a C solver that is called from C++.

Drone (blue trail) holding a 2 m-radius circle at 1.5 m altitude while the camera frustum (amber, dashed-green ideal) stays locked on the static ground target. Generated with python3 scripts/animate_xy.py --save-gif ... — see How to run.


Model

State and inputs

The quadrotor is modelled with 12 states and 4 inputs, using ZYX Euler angles.

State x ∈ ℝ¹²:

SymbolIndicesUnitDescription
x, y, z0–2mposition in world frame
vx, vy, vz3–5m/svelocity in world frame
φ, θ, ψ6–8radroll, pitch, yaw (ZYX Euler)
p, q, r9–11rad/sbody-frame angular rates

Input u ∈ ℝ⁴:

SymbolIndexUnitDescription
T0Ncollective thrust (sum of all rotor forces)
p_cmd1rad/scommanded roll rate
q_cmd2rad/scommanded pitch rate
r_cmd3rad/scommanded yaw rate

The inputs are thrust and commanded body rates — matching the interface of a real flight controller such as PX4, which exposes a body-rate setpoint API. The dynamics of the inner rate controller are captured by a first-order lag on each body rate (time constants in config/quadrotor.yaml under inner_loop).

Continuous-time ODE

Position kinematics — velocity integrates into position:

ẋ  = vx
ẏ  = vy
ż  = vz

Translational dynamics — thrust T acts along the body z-axis; rotating it to the world frame via R(φ,θ,ψ) gives the acceleration:

v̇x = T/m · (cos(ψ)·sin(θ)·cos(φ) + sin(ψ)·sin(φ))
v̇y = T/m · (sin(ψ)·sin(θ)·cos(φ) − cos(ψ)·sin(φ))
v̇z = T/m · cos(θ)·cos(φ) − g

The rotation is the ZYX convention: R = Rz(ψ) · Ry(θ) · Rx(φ). When the drone is level (φ = θ = 0) this reduces to v̇z = T/m − g, so T = mg at hover.

Euler angle kinematics — relates body rates (p, q, r) to Euler rates:

φ̇ = p + sin(φ)·tan(θ)·q + cos(φ)·tan(θ)·r
θ̇ =     cos(φ)·q         − sin(φ)·r
ψ̇ =    (sin(φ)·q         + cos(φ)·r) / cos(θ)

This transformation has a kinematic singularity at θ = ±90°. The pitch constraint (

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

lopopolo
精选
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI 与机器学习AI 智能体
2,390
slvDev
精选
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI 与机器学习大语言模型
1,960
littledivy
精选
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI 与机器学习
1,482