PX4-Autopilot/docs/zh/ros2/px4_ros2_interface_lib.md
PX4 Build Bot 62d0620eff
New Crowdin translations - zh-CN (#26553)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2026-03-05 14:00:49 +11:00

2.2 KiB
Raw Blame History

PX4 ROS 2 接口库

:::warning Experimental 在撰写本文时PX4 ROS 2 接口库的部分内容仍处于试验阶段,因此可能会发生变动。 :::

:::info When using rmw_zenoh, the PX4 ROS 2 Interface Library requires ROS 2 Jazzy or later, and is not compatible with ROS 2 Humble or earlier. :::

The PX4 ROS 2 Interface Library is a C++ library (with Python bindings) that simplifies controlling and interacting with PX4 from ROS 2.

该库为开发者提供了两个高级接口。

  1. Control Interface 允许开发者创建并动态注册使用 ROS2 编写的模式。 它为发送不同类型的设置点提供了课程,涵盖范围从高级导航任务一直到直接执行器控制。
  2. 导航界面 允许从ROS 2应用程序如VIO系统向PX4发送车辆位置估计数。
  3. Waypoint Missions 允许航点飞行任务完全在ROS2中运行。

在 ROS 2 工作区中安装

要开始使用现有ROS2工作空间内的库

  1. 请确保您在 ROS 2 工作区中有 ROS 2 设置 与 [px4_msgs](https://github.com/PX4/px4_msgs]。

  2. 将代码仓库克隆到工作空间中

    cd $ros_workspace/src
    git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
    

    提示信息 为确保兼容性,请使用 PX4、px4_msgsPX4 消息包)及该库的最新 main 分支。 另请参阅 [here]https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4

:::

  1. 构建工作空间:

    cd ..
    colcon building
    source install/setup.bash
    

ROS集成测试

向 PX4 提交拉取请求pull request持续集成CI会运行该库的集成测试 这些测试用于验证模式注册、故障保护failsafes和模式替换功能是否按预期工作。

欲了解更多信息,请访问PX4 ROS2 接口库集成测试