> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 在模拟器中使用 simulation_follow_me 启用人员跟踪

> simulation_follow_me 示例应用是一个能够实时检测、跟踪并跟随移动人员的 AMR。该应用集成传感器仿真和运动控制，在模拟环境中实现跟随人的行为。

<Note>
  更多信息请参阅 GitHub 上的 [simulation\_follow\_me](https://github.com/qualcomm-qrb-ros/qrb_ros_samples/tree/main/robotics/simulation_follow_me)。
</Note>

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/qualcomm-prod/zh/SDKs/QIR-SDK-Ubuntu/images/simulation-followme.gif" alt="Simulated warehouse in Gazebo where the robot detects a walking person and follows them along the aisle." />
</Frame>

## `simulation_follow_me` 的管道流程

下图展示了 `simulation_follow_me` 的管道流程。

<Frame caption="simulation_follow_me 管道。">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/qualcomm-prod/zh/SDKs/QIR-SDK-Ubuntu/images/simulation-followme-pipeline.png" alt="The simulation_follow_me pipeline linking Gazebo camera and depth nodes to the tracker, controller, and robot base node." />
</Frame>

## `simulation_follow_me` 管道中使用的 ROS 节点

下表列出了 `simulation_follow_me` 管道中使用的 ROS 节点，并说明了每个节点的功能。

| ROS 节点                 | 说明                                   |
| ---------------------- | ------------------------------------ |
| `camera node`          | 在 Gazebo 中将摄像头帧的 RGB 图像数据发布到 ROS 话题。 |
| `depth camera node`    | 在 Gazebo 中将摄像头帧的深度图像数据发布到 ROS 话题。    |
| `Root base node`       | 订阅控制命令并在 Gazebo 中与自主移动机器人（AMR）协调运动。  |
| `Follow me Tracker`    | 订阅摄像头信息并在设备上运行模型以进行目标检测。             |
| `Follow me Controller` | 在设备上发布运动执行的 `/cmd_vel` 命令。           |

## `simulation_follow_me` 管道中使用的 ROS 话题

下表列出了 `simulation_follow_me` 管道中使用的 ROS 话题，以及每个话题的消息类型、发布者或订阅者和说明。

| ROS 话题                    | 消息类型                      | 发布者/订阅者                     | 说明         |
| ------------------------- | ------------------------- | --------------------------- | ---------- |
| `/image_raw`              | `sensor_msgs.msg.Image`   | 订阅来自其他节点的图像。                | 表示用于处理的图像。 |
| `/camera/depth/image_raw` | `sensor_msgs.msg.Image`   | 由 `camera node` 发布。         | 发布图像深度话题。  |
| `/cmd_vel`                | `geometry_msgs.msg.Twist` | 由 `Follow me Controller` 发布 | 发布运动执行话题。  |

## 前提条件

你已根据[安装 QIR SDK](./install-the-qir-sdk)完成设备设置，并在设备上安装了 ROS2 Jazzy 和 Qualcomm Intelligent Robotics (QIR) SDK。

<Note>
  确保你已使用以太网电缆将开发板连接到仿真主机。否则，由于数据传输问题，示例的性能可能会下降。
</Note>

## 开箱即用运行 `simulation_follow_me`

<Steps>
  <Step title="在设备上运行 follow-me 功能">
    在设备上，根据[开箱即用运行 follow\_me](./followme#run-out-of-the-box-follow_me) 运行 follow-me 功能。
  </Step>

  <Step title="在主机的终端中，设置并运行 simulation_follow_me 示例应用">
    1. 在主机上，根据 [QRB ROS Simulation](https://github.com/qualcomm-qrb-ros/qrb_ros_simulation) 的 **README** 运行 `QRB Robot Base AMR`。确保设备和主机在同一本地网络上，并可以通过 ROS 通信相互通信。

    2. 在仿真环境中运行以下命令。

       ```bash Run the sample in Gazebo theme={null}
       # Run samples in Gazebo
       git clone https://github.com/qualcomm-qrb-ros/qrb_ros_samples.git
       cd robotics/simulation_follow_me

       export ROS_DOMAIN_ID=123
       ros2 launch qrb_ros_sim_gazebo gazebo_robot_base_mini.launch.py world_model:=warehouse_followme_path2  rgb_camera_config_file:=$(pwd)/followme_rgb_camera_params.yaml enable_laser:=false enable_imu:=false
       ```
  </Step>
</Steps>
