跳过主要内容

障碍物定位

carla 模拟器 给我们与许多更多传感器协作的可能,不仅是一个摄头。 我们可以模拟LIDAR(激光雷达)、IMU(陀螺仪-加速度计-磁力计)、深度传感器、分割传感器......

让我们使用激光雷达传感器定位“yolov5”定位的障碍物的确切位置。

雷达点数据是数据点集合,形如x, y, z, 强度 的数组 。

坐标基于虚幻引擎坐标系统,即:

  • z 是向上
  • x 是向前
  • y 是向右

更多信息: https://www.techarthub.com/a-practical-guide-to-unreal-engine-4s-coordinate-system/

以及 carla 文档: https://carla.readthedocs.io/en/latest/ref_sensors/#lidar-sensor

您还可以查看 velodyne 参考: https://github.com/ros-drivers/velodyne/blob/master/velodyne_pcl/README.md

为了获得障碍物位置,我们将计算点数据中的每个点的角度。 我们可以将边界框的每个像素的角度映射到一个真实点,从而推断其位置。 我们通过添加 LIDAR 传感器的当前位置,将坐标从相对 lIDAR 坐标系转换为全局坐标系。 代码在此: operators/obstacle_location_op.py.

要使用障碍物位置,只需将其添加到图中,并附上:

nodes:
- id: oasis_agent
custom:
inputs:
tick: dora/timer/millis/400
outputs:
- position
- speed
- image
- objective_waypoints
- lidar_pc
- opendrive
source: shell
# With Carla_source_node
args: python3 ../../carla/carla_source_node.py
#
# Or with the OASIS AGENT
#
# args: >
# python3 $SIMULATE --output
# --oasJson --criteriaConfig $CRITERIA
# --openscenario $XOSC
# --agent $TEAM_AGENT
# --agentConfig $TEAM_AGENT_CONF
# --destination $DESTINATION

- id: yolov5
operator:
outputs:
- bbox
inputs:
image: oasis_agent/image
python: ../../operators/yolov5_op.py

- id: obstacle_location_op
operator:
outputs:
- obstacles
inputs:
lidar_pc: oasis_agent/lidar_pc
obstacles_bbox: yolov5/bbox
position: oasis_agent/position
python: ../../operators/obstacle_location_op.py

- id: plot
operator:
python: ../../operators/plot.py
inputs:
image: oasis_agent/image
obstacles_bbox: yolov5/bbox
position: oasis_agent/position
obstacles: obstacle_location_op/obstacles

至运行:

dora up
dora start graphs/oasis/oasis_agent_obstacle_location.yaml --attach

您应该能够在边界框中看到一个点,表示障碍物全局坐标中的估计位置。

更多信息在 obstacle_location,去至 我们的 obstacle_location 细节页面