# MRPT

**MRPT**（Mobile Robot Programming Toolkit，移动机器人编程工具包）是一个面向移动机器人学的开源 C++ 框架，提供用于同时定位与建图（SLAM）、定位、计算机视觉和运动规划的库及开箱即用的应用程序。它最初于 2005 年在马拉加大学（University of Málaga）开发，采用三条款 BSD 许可证发布。<sup>[1](https://github.com/MRPT/mrpt)</sup><sup> • </sup><sup>[2](https://docs.mrpt.org/reference/latest/index.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 面向移动机器人学的 C++ 框架：SLAM、定位、导航、计算机视觉与传感器驱动<sup>[1](https://github.com/MRPT/mrpt)</sup><sup> • </sup><sup>[3](https://www.mrpt.org/downloads/mrpt-book.pdf)</sup> |
| 起源 | 自 2005 年起在马拉加大学开发；持续活跃维护<sup>[1](https://github.com/MRPT/mrpt)</sup> |
| 许可证 | 三条款 BSD，开源<sup>[2](https://docs.mrpt.org/reference/latest/index.html)</sup> |
| SLAM 算法 | ICP-SLAM、Rao-Blackwell 化粒子滤波 SLAM（rbpf-slam）、基于 EKF 的 kf-slam、仅测距 SLAM、图 SLAM 与 HMT-SLAM<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup><sup> • </sup><sup>[5](https://www.mrpt.org/list-of-mrpt-apps/application-kf-slam/)</sup> |
| 地图类型 | 占用栅格地图、点地图、路标地图、体素地图<sup>[1](https://github.com/MRPT/mrpt)</sup> |
| 传感器 | 激光雷达、立体相机与 RGB-D 相机、IMU、GPS、Velodyne 等<sup>[1](https://github.com/MRPT/mrpt)</sup> |
| 语言绑定 | C++ 核心，所有主要模块均提供 pybind11 Python 绑定<sup>[1](https://github.com/MRPT/mrpt)</sup> |
| 当前结构 | MRPT 3.x 组织为基于 C++17 构建的独立 colcon 包<sup>[1](https://github.com/MRPT/mrpt)</sup> |

## 范围与能力

MRPT 提供常见机器人学研究领域所用的数据结构和算法，其既定目标是让研究人员能够在 SLAM、计算机视觉和运动规划中设计和实现算法，而不必拼凑数据结构互不兼容的异构库。<sup>[2](https://docs.mrpt.org/reference/latest/index.html)</sup><sup> • </sup><sup>[3](https://www.mrpt.org/downloads/mrpt-book.pdf)</sup> 其能力领域包括：

- **SLAM 与定位**：[蒙特卡洛定位](https://www.edgepedia.org/zh/monte-carlo-localization)、基于 RBPF 的 SLAM 与位姿图优化。<sup>[1](https://github.com/MRPT/mrpt)</sup>
- **几何与概率**：SE(2)/SE(3) 李群、刚体变换、卡尔曼滤波、粒子滤波，以及位姿与地图上的概率密度函数。<sup>[1](https://github.com/MRPT/mrpt)</sup>
- **地图与传感器**：占用栅格地图、点地图、路标地图与体素地图，以及激光雷达、立体相机与 RGB-D 相机、IMU、GPS 和 Velodyne 传感器的驱动。<sup>[1](https://github.com/MRPT/mrpt)</sup>
- **导航与可视化**：反应式导航、路径规划、基于 PTG 的避障、三维场景图（`mrpt::viz`）、GUI 窗口与绘图控件。<sup>[1](https://github.com/MRPT/mrpt)</sup>

该工具包还附带开箱即用的应用程序，用户无需编写源代码即可记录机器人数据、操作日志、构建点地图或占用栅格地图；示例程序包括 pf-localization、rbpf-slam、rawlog-grabber 和 RawLogViewer。<sup>[3](https://www.mrpt.org/downloads/mrpt-book.pdf)</sup>

## SLAM 算法

MRPT 将每种 SLAM 算法与特定的观测类型和地图类型相匹配，按输入传感器分组。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup>

- **二维激光扫描仪**（`CObservation2DRangeScan`）供 rbpf-slam 和 icp-slam 使用，生成二维占用栅格地图（`COccupancyGridMap2D`）或点云（`CPointsMap`）。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup>
- **声呐传感器**（`CObservationRange`）供 rbpf-slam 用于二维占用栅格建图。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup>
- **距离-方位路标**（`CObservationBearingRange`）由基于 EKF 的 kf-slam 应用处理，该应用在完整六维机器人状态空间中求解通用三维距离-方位传感器的 SLAM 问题，并可选择运行同一问题的二维版本——文档称这种做法在平面环境中更为高效。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup><sup> • </sup><sup>[5](https://www.mrpt.org/list-of-mrpt-apps/application-kf-slam/)</sup>
- **单目图像特征**：来自视觉 SLAM 前端的特征由仅含后端的光束法平差示例处理。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup>
- **仅测距传感器**（`CObservationBeaconRanges`）由集成于 RBPF-SLAM 框架中的仅测距 SLAM 方案处理；每个粒子携带一个扩展状态向量，用于估计各信标或锚点的当前偏置。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup><sup> • </sup><sup>[6](https://docs.mrpt.org/reference/master/range_only_localization_mapping.html)</sup>
- **相对位姿**由位姿图或图 SLAM 方法处理，这些方法对位姿约束图进行优化。<sup>[4](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)</sup><sup> • </sup><sup>[3](https://www.mrpt.org/downloads/mrpt-book.pdf)</sup>

**粒子滤波 SLAM。** RBPF-SLAM 实现将 Rao-Blackwell 化粒子滤波视为粒子滤波的一个特例，因此其 C++ 基类中的任何通用滤波算法都可以顺序估计机器人路径，包括采用标准提议分布的序列重要性重采样（SIR）和采用标准提议的辅助粒子滤波（APF）。2011 年 8 月的一份教程说明指出，当时尚不存在使用 APF 算法的 RBPF-SLAM 实现。<sup>[7](https://www.mrpt.org/tutorials/slam-algorithms/rbpf-slam_algorithms/)</sup>

**分层拓扑度量 SLAM。** HMT-SLAM 在 mrpt-hmtslam 库中实现，在统一的概率框架中同时处理底层度量算法和高层拓扑推理。<sup>[8](https://www.mrpt.org/tutorials/slam-algorithms/hmt-slam/)</sup>

**运动模型。** 对于数据融合、SLAM 和定位，MRPT 提供针对 SE(2) 或 SE(3) 位姿增量不确定性的概率运动模型：两个 SE(2) 模型和一个 SE(3) 模型，分别在 `CActionRobotMovement2D` 和 `CActionRobotMovement3D` 中实现。SE(2) 实现可为每个位姿分量（x、y、φ）添加可选的白高斯噪声，使得零里程计增量不会让粒子集静止不动——那会导致粒子滤波退化。<sup>[9](https://github.com/MRPT/mrpt/blob/develop/doc/source/tutorial-motion-models.rst)</sup>

## 软件结构与集成

**MRPT 3.x。** 3.0 版是一次重大重构，将构建系统现代化为基于 colcon 的模块化包，清理了公共 API，并适配 C++17，同时保留核心数据结构和算法。该工具包拆分为独立包，如 `mrpt_core`、`mrpt_math`、`mrpt_poses`、`mrpt_obs`、`mrpt_maps`、`mrpt_slam`、`mrpt_viz`、`mrpt_nav`、`mrpt_bayes` 和 `mrpt_hwdrivers`，每个包均可独立构建和使用。相对于 2.x 系列，包名从 `mrpt-<name>` 改为 `mrpt_<name>`，CMake 目标从 `mrpt::<name>` 改为 `mrpt::mrpt_<name>`。<sup>[1](https://github.com/MRPT/mrpt)</sup>

**ROS 集成。** 在 ROS 节点中，将 `mrpt_libs` 声明为包依赖即可使用 MRPT 库，源码树中提供了示例 C++ 节点。可从 ROS 软件仓库安装：ROS 1 使用 `ros-$ROS_DISTRO-mrpt2`（已标记为弃用），[ROS 2](https://www.edgepedia.org/zh/ros-2) 使用 `ros-$ROS_DISTRO-mrpt-*`，并针对包括 Humble、Jazzy、Kilted、Lyrical 和 Rolling 在内的 ROS 2 发行版跟踪持续集成构建状态。<sup>[10](https://www.mrpt.org/tutorials/programming/first-steps/how_to_use_mrpt_libraries_from_a_ros_node/)</sup><sup> • </sup><sup>[1](https://github.com/MRPT/mrpt)</sup>

**Python。** 所有主要模块均有 pybind11 绑定，以 `mrpt` Python 包的形式提供；`mrpt.slam` 模块提供诸如 `CICP`（用于地图对齐）、`CMetricMapBuilderICP`（用于基于 ICP 的 SLAM）、`CMetricMapBuilderRBPF`（用于 Rao-Blackwell 化粒子滤波 SLAM）以及 `CMonteCarloLocalization2D/3D`（通过 `mrpt.bayes.CParticleFilter.executeOn()` 运行的粒子滤波定位）等类。<sup>[1](https://github.com/MRPT/mrpt)</sup><sup> • </sup><sup>[11](https://docs.mrpt.org/reference/develop/python_api/mrpt/slam/index.html)</sup>

**安装。** 在 Ubuntu 和 Debian 上，可通过 `sudo apt install libmrpt-dev mrpt-apps` 安装软件包；稳定版和每日构建版 PPA 提供更新的构建，Windows 安装程序附带可执行文件和开发库，源码构建则使用 `git clone --recursive` 后接 colcon。<sup>[1](https://github.com/MRPT/mrpt)</sup><sup> • </sup><sup>[12](https://docs.mrpt.org/reference/latest/download-mrpt.html)</sup>

## 生态系统与相关项目

MRPT 是 MOLA 模块化 SLAM 框架的核心库。<sup>[1](https://github.com/MRPT/mrpt)</sup> 性能基准测试由 mrpt-performance 应用程序自动完成，该程序于 2018 年移至独立仓库，跨平台和编译器的结果发布在 performance.mrpt.org。<sup>[2](https://docs.mrpt.org/reference/latest/index.html)</sup> 由 Jose Luis Blanco-Claraco 维护的 GitHub 仓库显示约 2.2k 星标和 660 个复刻仓库。<sup>[1](https://github.com/MRPT/mrpt)</sup> 一项大学对机器人框架的比较研究将 MRPT 的主要用途概括为机器人研究、SLAM、导航和计算机视觉，而 ROS 则主要面向机器人开发、研究和部署。<sup>[13](https://scholar.ppu.edu/bitstream/handle/123456789/9255/Personalized%20Tracking%20Robot.pdf?isAllowed=y&sequence=1)</sup>

## References

1. [MRPT/mrpt: The Mobile Robot Programming Toolkit, GitHub repository](https://github.com/MRPT/mrpt)
2. [MRPT documentation, About page (2.15.13)](https://docs.mrpt.org/reference/latest/index.html)
3. [Jose Luis Blanco Claraco, Development of Scientific Applications with the Mobile Robot Programming Toolkit (MRPT reference book, 2010)](https://www.mrpt.org/downloads/mrpt-book.pdf)
4. [SLAM algorithms in MRPT, MRPT documentation](https://docs.mrpt.org/reference/latest/tutorial-slam-algorithms.html)
5. [Application: kf-slam, MRPT](https://www.mrpt.org/list-of-mrpt-apps/application-kf-slam/)
6. [Range-only Localization and Mapping Solutions, MRPT 3.5.1 documentation](https://docs.mrpt.org/reference/master/range_only_localization_mapping.html)
7. [RBPF-SLAM algorithms (C++ library mrpt-slam), MRPT tutorial](https://www.mrpt.org/tutorials/slam-algorithms/rbpf-slam_algorithms/)
8. [HMT-SLAM, MRPT tutorial](https://www.mrpt.org/tutorials/slam-algorithms/hmt-slam/)
9. [Probabilistic motion models tutorial, MRPT GitHub](https://github.com/MRPT/mrpt/blob/develop/doc/source/tutorial-motion-models.rst)
10. [How to use MRPT libraries from a ROS node, MRPT tutorial](https://www.mrpt.org/tutorials/programming/first-steps/how_to_use_mrpt_libraries_from_a_ros_node/)
11. [mrpt.slam, MRPT Python API documentation](https://docs.mrpt.org/reference/develop/python_api/mrpt/slam/index.html)
12. [Download MRPT, MRPT documentation](https://docs.mrpt.org/reference/latest/download-mrpt.html)
13. [Personalized Tracking Robot thesis, Palestine Polytechnic University (ROS Noetic vs MRPT comparison)](https://scholar.ppu.edu/bitstream/handle/123456789/9255/Personalized%20Tracking%20Robot.pdf?isAllowed=y&sequence=1)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 工程与制造 › 机器人技术与自动化 › Robot software, AI, and methods › SLAM and visual odometry

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/mrpt

English original: https://www.edgepedia.org/mrpt
