apollo_perception_traffic_light

/apollo/perception/traffic_light 数据通道(channel)是 Apollo 系统交通灯检测块输出的交通灯数据消息通道。

本文档介绍 /apollo/perception/traffic_light 通道里各数据字段的含义。

前提条件

您需要提前了解:

通道数据解释

/apollo/perception/traffic_light 通道示例

当道路中出现红绿灯时,/apollo/perception/traffic_light 通道会输出检出的红绿灯信息,数据如下所示。

ChannelName: /apollo/perception/traffic_light
MessageType: apollo.perception.TrafficLightDetection
FrameRatio: 0.00
RawMessage Size: 237 Bytes
traffic_light: +[2 items]
header:
  timestamp_sec: 1629688056.841848612
  camera_timestamp: 1629688056775090944
traffic_light_debug:
  cropbox:
    x: 1279
    y: 356
    width: 270
    height: 270
  box: +[4 items]
  signal_num: 2
  distance_to_stop_line: 84.620239540
  crop_roi: +[2 items]
  projected_roi: +[2 items]
  rectified_roi: +[2 items]
contain_lights: 1
camera_id: CAMERA_FRONT_NARROW

整个数据通道内的数据可以分为两部分:CyberRT 框架定义的元数据和通道对应的消息格式(Message)所定义的消息数据。

CyberRT 框架定义的元数据

该部分包括 ChannelName、MessageType、FrameRatio、RawMessage Size 数据字段,参见 数据通道。

ChannelName: /apollo/perception/traffic_light
MessageType: apollo.perception.TrafficLightDetection
FrameRatio: 0.00
RawMessage Size: 237 Bytes

其中,MessageType 定义了当前通道对应的消息格式(Message)为apollo.perception.TrafficLightDetection。

消息格式(Message)所定义的消息数据

该部分数据字段由 apollo.perception.TrafficLightDetection 消息格式(Message)定义。

traffic_light: +[2 items]
header:
  timestamp_sec: 1629688056.841848612
  camera_timestamp: 1629688056775090944
traffic_light_debug:
  cropbox:
    x: 1279
    y: 356
    width: 270
    height: 270
  box: +[4 items]
  signal_num: 2
  distance_to_stop_line: 84.620239540
  crop_roi: +[2 items]
  projected_roi: +[2 items]
  rectified_roi: +[2 items]
contain_lights: 1
camera_id: CAMERA_FRONT_NARROW

下一小节,将逐一详细介绍这部分消息的数据字段含义。

apollo.perception.TrafficLightDetection 等消息格式(Message)定义的数据字段

apollo.perception.TrafficLightDetection 消息格式(Message)

其定义了如下 5 个重要数据字段。

数据名称 数据解释 Protobuf Message 定义
traffic_light 红绿灯列表,里面列出了每一个检出的红绿灯详细信息。 由 apollo.perception.TrafficLight定义
header 头信息。 由 apollo.common.Header 定义
traffic_light_debug 红绿灯调试信息。 由 apollo.perception.TrafficLightDebug 定义
contain_lights 是否有红绿灯。 bool 类型
camera_id 对应的摄像头信息。 类型参见 enum CameraID
traffic_light: +[2 items]
header:
  timestamp_sec: 1629688056.841848612
  camera_timestamp: 1629688056775090944
traffic_light_debug:
  cropbox:
    x: 1279
    y: 356
    width: 270
    height: 270
  box: +[4 items]
  signal_num: 2
  distance_to_stop_line: 84.620239540
  crop_roi: +[2 items]
  projected_roi: +[2 items]
  rectified_roi: +[2 items]

apollo.perception.TrafficLight 消息格式(Message)

在 Cyber Monitor 工具中查看 /apollo/perception/traffic_light 通道信息时,可以通过键盘的方向键【->】进入下一层查看 traffic_light 字段的具体数据,该字段数据是由apollo.perception.TrafficLight 消息格式(Message)定义的数据 列表。同时,可以通过键盘上的 N 和 M 键来遍历 traffic_light 列表中的每一个具体数据。

traffic_light 示例如下:

MessageType: apollo.perception.TrafficLightDetection
FrameRatio: 0.00
traffic_light: [1]
  color: RED
  id: 20454
  confidence: 0.999711692
  blink: 0

apollo.perception.TrafficLight 消息格式(Message)定义了如下的重要数据字段。

数据名称 数据解释 取值 单位
color 红绿灯的颜色 UNKNOWN/RED/YELLOW/GREEN/BLACK -
id 障碍物的唯一身份标签 0-1000000 -
confidence 置信度 - -
blink 红绿灯是否闪烁 true/false bool

深入了解 TrafficLightDetection 数据类型

深入了解apollo.perception.TrafficLightDetection 等消息格式(Message)定义,参见 traffic_light_detection.proto 文件。关于 protobuf 与 消息格式(Message)的关系,参见 消息格式。

文档意见反馈

如果您在使用文档时遇到任何问题,请到我们在【开发者社区】建立的反馈意见收集问答页面,反馈相关的问题。我们会根据反馈意见对文档进行迭代优化。

apollo_perception_obstaclesCANBUS模块