提交 7909ff37 编写于 作者: A Aaron Xiao 提交者: Qi Luo

Tools: Support map field in diagnostics tool.

上级 ad655a28
......@@ -43,6 +43,7 @@ from modules.routing.proto import routing_pb2
from modules.drivers.proto import mobileye_pb2
from modules.drivers.proto import delphi_esr_pb2
from modules.drivers.proto import conti_radar_pb2
from modules.monitor.proto import system_status_pb2
Refreshrate = 16
......@@ -233,10 +234,14 @@ class Field(object):
if self.descriptor.containing_type is not None and \
self.descriptor.label == self.descriptor.LABEL_REPEATED:
if self.index is not None:
if 'keys' in dir(self.item):
# For map field.
key = sorted(self.item.keys())[self.index]
else:
key = self.index
self.window.addstr(
0, 0, self.descriptor.name + ": " + str(self.index),
curses.A_BOLD)
self.print_out(self.item[self.index], self.descriptor, 1, 2)
0, 0, self.descriptor.name + ": " + str(key), curses.A_BOLD)
self.print_out(self.item[key], self.descriptor, 1, 2)
else:
self.window.addstr(0, 0, self.descriptor.name + ": Empty",
curses.A_BOLD)
......
......@@ -15,5 +15,6 @@ ROUTING_REQ routing_pb2.RoutingRequest() /apollo/routing_request
MOBILEYE mobileye_pb2.Mobileye() /apollo/sensor/mobileye 10
DELPHI_ESR delphi_esr_pb2.DelphiESR() /apollo/sensor/delphi_esr 10
CONTI_Radar conti_radar_pb2.ContiRadar() /apollo/sensor/conti_radar 10
SIGNAL_LIGHT traffic_light_detection_pb2.TrafficLightDetection() /apollo/perception/traffic_light 10
DRIVE_EVENT drive_event_pb2.DriveEvent() /apollo/drive_event 500
SIGNAL_LIGHT traffic_light_detection_pb2.TrafficLightDetection() /apollo/perception/traffic_light 10
DRIVE_EVENT drive_event_pb2.DriveEvent() /apollo/drive_event 500
SYSTEM_STATUS system_status_pb2.SystemStatus() /apollo/monitor/system_status 500
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册