# ACADO工具包

**ACADO工具包**（ACADO Toolkit）是一个用于自动控制与动态优化的开源软件环境和算法集合，为包括模型预测控制（MPC）、状态与参数估计以及鲁棒优化在内的直接最优控制方法提供了通用框架。<sup>[1](https://github.com/acado/acado)</sup> 它以自包含的C++代码实现，并配有用户友好的MATLAB接口；其面向对象的设计允许与现有优化软件包耦合，也可用用户自编程序进行扩展。<sup>[1](https://github.com/acado/acado)</sup> 该工具包由鲍里斯·豪斯卡（Boris Houska）、汉斯·约阿希姆·费罗（Hans Joachim Ferreau）和莫里茨·迪尔（Moritz Diehl）在2011年发表于《最优控制应用与方法》（*Optimal Control Applications and Methods*）的论文中首次介绍。<sup>[2](https://onlinelibrary.wiley.com/doi/10.1002/oca.939)</sup>

| 关键事实 | 详情 |
|---|---|
| 用途 | 直接最优控制的框架：模型预测控制、状态与参数估计以及鲁棒优化<sup>[1](https://github.com/acado/acado)</sup> |
| 实现 | 自包含的C++代码库，配有MATLAB接口；LGPL-3.0许可证<sup>[1](https://github.com/acado/acado)</sup> |
| 原始发表 | 豪斯卡、费罗、迪尔，《最优控制应用与方法》32(3)，第298-312页，2011年<sup>[2](https://onlinelibrary.wiley.com/doi/10.1002/oca.939)</sup> |
| 代码生成 | 通过采用高斯-牛顿海森近似（Gauss-Newton Hessian approximation）的实时迭代方案，导出针对问题定制的、自包含的C代码，用于非线性MPC和滚动时域估计（MHE）<sup>[3](https://acado.github.io/cgt_overview.html)</sup><sup> • </sup><sup>[4](https://acado.github.io/features.html)</sup> |
| 报告速度 | 在一个控制时域为十个采样周期的四状态测试问题上，导出的代码给出反馈所需的时间远小于一毫秒<sup>[5](https://faculty.sist.shanghaitech.edu.cn/faculty/boris/autogeneratedMPC.html)</sup> |
| 后继者 | acados，一个使用CasADi符号系统的C语言重写版本，其开发者将其描述为ACADO工具包的后继者<sup>[6](https://www.syscop.de/files/2021ss/acados_workshop/2021_FOR_workshop.pdf)</sup><sup> • </sup><sup>[7](https://groups.google.com/g/casadi-users/c/Z_zu8hqTR3A)</sup> |
| 仓库活跃度 | GitHub上约585-588颗星、250个复刻、1,477次提交<sup>[1](https://github.com/acado/acado)</sup> |

## 工具包提供的功能

ACADO处理两类在线动态优化问题：一类是MPC问题，即寻找近似最优的控制动作以反馈给受控过程；另一类是滚动时域估计问题，即根据输出测量估计当前过程状态。高斯-牛顿算法处理这些问题中通常出现的最小二乘项，并且提供估计状态和参数的方差-协方差计算等后验工具。<sup>[4](https://acado.github.io/features.html)</sup> 该工具包还包括独立的龙格-库塔（Runge-Kutta）和BDF积分器，用于模拟常微分方程和微分代数方程。<sup>[8](https://acado.github.io/matlab_overview.html)</sup>

MATLAB接口是C++代码库之上的一层薄封装。它公开了积分器、用于以MATLAB语法构建问题的通用最优控制接口，以及代码生成导出功能：用于定制龙格-库塔积分器的SIMexport和用于定制最优控制求解器的OCPexport。模型可以从MATLAB、C++或C链接，并可选择用户提供的雅可比矩阵以加快计算。<sup>[8](https://acado.github.io/matlab_overview.html)</sup>

## 代码生成工具

ACADO代码生成工具为标准形式的非线性MPC和MHE问题导出优化的C代码：以状态和控制为变量的最小二乘目标函数，受模型动力学、控制与状态的箱约束以及一般路径约束和终端约束的约束。<sup>[3](https://acado.github.io/cgt_overview.html)</sup> 连续时间常微分方程和微分代数方程的[离散化](https://www.edgepedia.org/zh/discretization)通过打靶技术完成，所得的稀疏二次规划可选择性地凝聚后传递给稠密求解器。<sup>[3](https://acado.github.io/cgt_overview.html)</sup>

导出的求解器针对具体问题量身定制。代码通过以下方式获得速度：预先固定所有问题维度、省去动态内存分配、展开循环、符号化简表达式，以及以恒定步长进行积分——据该项目称，这些措施相对于通用实现可带来显著的性能提升。<sup>[4](https://acado.github.io/features.html)</sup> 支持的二次规划求解器包括[qpOASES](https://www.edgepedia.org/zh/qpoases)的嵌入式变体（一种有效集方法）、利用结构的内点求解器FORCES和HPMPC，以及对偶分解求解器qpDUNES。<sup>[3](https://acado.github.io/cgt_overview.html)</sup>

该方法与工具包本身同时发表：一种面向千赫兹采样率的实时非线性MPC自动C代码生成策略，在ACADO中实现，导出带有其灵敏度的固定步长积分器以及实时高斯-牛顿方法。在已发表的测试中，对于具有四个状态、控制时域为十个采样周期的受约束非线性系统，导出的代码给出反馈所需的时间远小于一毫秒。<sup>[5](https://faculty.sist.shanghaitech.edu.cn/faculty/boris/autogeneratedMPC.html)</sup>

## 相对于其他求解器的性能

在acados论文中报告的一个质点链闭环基准测试中，GRAMPC和acados以几乎相同的速度产生解，两者的速度都约为ACADO的2倍，而ACADO的速度又为VIATOC的2-3倍。所有四个嵌入式求解器在整个实验中各自的计算耗时都保持稳定，作者指出这一特性对于必须满足固定时间期限的嵌入式求解器很重要。<sup>[9](https://publications.syscop.de/Verschueren2021.pdf)</sup> 另一项GRAMPC基准测试发现，ACADO以其积分方案很好地处理了刚性半隐式动力学，并且其海森近似使其对状态和控制的不良缩放不太敏感，尽管其计算时间随系统维度的增长比GRAMPC更明显。<sup>[10](https://link.springer.com/article/10.1007/s11081-018-9417-2)</sup>

## 应用

ACADO代码生成已在机器人和车辆控制中得到应用：

- 一项2022年关于自主四旋翼飞行器在移动平台上降落的研究使用MATLAB和ACADO工具箱进行快速原型设计，并在机载的[树莓派4](https://www.edgepedia.org/zh/raspberry-pi-4)（Raspberry Pi 4）上实时运行生成的MPC求解器，在实验室实验中安全完成了降落任务。<sup>[11](https://www.research.unipd.it/handle/11577/3472275)</sup>
- 针对10状态四旋翼模型的实时管状MPC，使用ACADO的自动代码生成实现，运行时间达到较低的毫秒范围。<sup>[12](https://iris.imtlucca.it/handle/20.500.11771/21503)</sup>
- 一个考虑非线性横向轮胎动力学的城市自动驾驶NMPC轨迹规划器，使用ACADO工具包耦合qpOASES求解其问题，并在CarMaker多体车辆模型上进行了测试。<sup>[13](https://arxiv.org/abs/2105.04034)</sup>
- 多旋翼的模型预测轮廓控制已建立在ACADO的C++接口之上，将四旋翼模型转换为用qpOASES求解的二次规划。<sup>[14](https://github.com/ChanJoon/mpcc)</sup>
- 代码生成工具的首次实验验证是在一台桥式起重机上进行的。<sup>[4](https://acado.github.io/features.html)</sup>

## 状态与后继者

[SourceForge](https://www.edgepedia.org/zh/sourceforge)项目页面将工具包的状态列为测试版。<sup>[15](https://sourceforge.net/p/acado/wiki/Documentation/)</sup> 在[机器人操作系统](https://www.edgepedia.org/zh/robot-operating-system)（ROS）生态系统中，为较旧发行版发布了acado包版本1.2.1，而为较新发行版发布的1.2.3包被标记为无人维护。<sup>[16](https://index.ros.org/r/acado/)</sup> 开发工作已转移到acados，在syscop研讨会的演示中被描述为ACADO工具包的后继者；acados用C编写，使用CasADi符号框架处理模型函数，并依赖BLASFEO线性代数库和HPIPM内点求解器。<sup>[6](https://www.syscop.de/files/2021ss/acados_workshop/2021_FOR_workshop.pdf)</sup><sup> • </sup><sup>[7](https://groups.google.com/g/casadi-users/c/Z_zu8hqTR3A)</sup> 2025年的一份开源MPC工具综述将ACADO和acados都描述为着眼于嵌入式应用、追求效率和快速求解，并将ACADO的接口列为C++和MATLAB，具有嵌入式侧重。<sup>[17](https://onlinelibrary.wiley.com/doi/full/10.1002/rnc.7275)</sup>

## References

1. [ACADO Toolkit GitHub repository](https://github.com/acado/acado)
2. [Houska, B., Ferreau, H.J., Diehl, M. (2011). ACADO toolkit - An open-source framework for automatic control and dynamic optimization. Optimal Control Applications and Methods 32(3): 298-312.](https://onlinelibrary.wiley.com/doi/10.1002/oca.939)
3. [The ACADO Code Generation Tool](https://acado.github.io/cgt_overview.html)
4. [ACADO Toolkit Features](https://acado.github.io/features.html)
5. [Houska, B., Ferreau, H.J., Diehl, M. (2011). An auto-generated real-time iteration algorithm for nonlinear MPC in the microsecond range. Automatica 47(10): 2279-2285.](https://faculty.sist.shanghaitech.edu.cn/faculty/boris/autogeneratedMPC.html)
6. [The acados software package - Fast, embeddable solvers for nonlinear optimal control (syscop workshop slides)](https://www.syscop.de/files/2021ss/acados_workshop/2021_FOR_workshop.pdf)
7. [Performance of CasADi vs. ACADO for NMPC, CasADi users group](https://groups.google.com/g/casadi-users/c/Z_zu8hqTR3A)
8. [ACADO from MATLAB](https://acado.github.io/matlab_overview.html)
9. [Verschueren, R. et al. (2021). acados - a modular open-source framework for fast embedded optimal control.](https://publications.syscop.de/Verschueren2021.pdf)
10. [GRAMPC: A software framework for embedded nonlinear MPC using a gradient-based augmented Lagrangian approach. Optimization and Engineering.](https://link.springer.com/article/10.1007/s11081-018-9417-2)
11. [Pozzan, B., Elaamery, B., Cenedese, A. (2022). Non-Linear Model Predictive Control for autonomous landing of a UAV on a moving platform. IEEE CCTA.](https://www.research.unipd.it/handle/11577/3472275)
12. [Hu, H. et al. (2018). Real-Time Tube MPC Applied to a 10-State Quadrotor Model. ACC.](https://iris.imtlucca.it/handle/20.500.11771/21503)
13. [NMPC trajectory planner for urban autonomous driving (arXiv:2105.04034)](https://arxiv.org/abs/2105.04034)
14. [Model Predictive Contouring Control for multi-rotors with ACADO Toolkit (GitHub)](https://github.com/ChanJoon/mpcc)
15. [ACADO Toolkit Wiki - Documentation (SourceForge)](https://sourceforge.net/p/acado/wiki/Documentation/)
16. [acado - ROS Repository Overview](https://index.ros.org/r/acado/)
17. [Pohlodek, M. et al. (2025). Flexible development and evaluation of machine-learning-supported optimal control and estimation methods via HILO-MPC. International Journal of Robust and Nonlinear Control.](https://onlinelibrary.wiley.com/doi/full/10.1002/rnc.7275)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 工程与制造 › 机器人技术与自动化 › Robot software, AI, and methods › Optimal control, model predictive control, and safe control

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/acado-toolkit

English original: https://www.edgepedia.org/acado-toolkit
