MCPcopy Create free account
hub / github.com/AutonomousVehicleLaboratory/SemVecNet / DynamicMap

Class DynamicMap

semantic_mapping/src/dynamic_map.py:18–559  ·  view source on GitHub ↗

Dynamic Map Expose interface that are transparent to outside as a big map Internal implementation using map tiles

Source from the content-addressed store, hash-verified

16
17# Classes
18class DynamicMap():
19 """ Dynamic Map
20 Expose interface that are transparent to outside as a big map
21 Internal implementation using map tiles
22 """
23 def __init__(self, cfg, logger=None) -> None:
24 self.logger = logger
25
26 self.depth_method = cfg.MAPPING.DEPTH_METHOD
27 self.pcd_range_max = cfg.MAPPING.PCD.RANGE_MAX
28 self.use_pcd_intensity = cfg.MAPPING.PCD.USE_INTENSITY
29 self.use_distance = cfg.MAPPING.PCD.USE_DISTANCE
30 self.use_angular_velocity = cfg.MAPPING.PCD.USE_ANGULAR_VELOCITY
31
32 self.map = None # current map in logits
33 self.map_rendered = None # current map rendered
34 self.render_ego_centric = cfg.MAPPING.RENDER_EGO_CENTRIC # render ego centric map
35 self.resolution = cfg.MAPPING.RESOLUTION
36
37 self.label_names = cfg.LABELS_NAMES
38 self.label_colors = np.array(cfg.LABEL_COLORS)
39 self.color_remap_source = np.array(cfg.COLOR_REMAP_SOURCE)
40 self.color_remap_dest = np.array(cfg.COLOR_REMAP_DEST)
41
42 self.map_tile = {} # Dictionary of smaller map tiles
43 self.tile_size_meter = cfg.MAPPING.TILE_SIZE_METER # meter
44 self.tile_size_d = int(self.tile_size_meter / self.resolution) # grid size
45 self.pad_num = cfg.MAPPING.TILE_PAD_NUMBER # number of tiles on each direction
46 self.pad_total_num = 2 * self.pad_num + 1
47 self.map_boundary = None
48 self.render_global_map_flag = cfg.MAPPING.RENDER_GLOBAL_MAP_FLAG
49
50 self.map_height = int(self.pad_total_num * self.tile_size_d)
51 self.map_width = int(self.pad_total_num * self.tile_size_d)
52 self.map_depth = len(self.label_names)
53
54 self.ego_x_min, self.ego_x_max, self.ego_y_min, self.ego_y_max = cfg.MAPPING.RANGE
55
56 self.ego_x_max_d = int(self.ego_x_max / self.resolution)
57 self.ego_x_min_d = int(self.ego_x_min / self.resolution)
58 self.ego_y_max_d = int(self.ego_y_max / self.resolution)
59 self.ego_y_min_d = int(self.ego_y_min / self.resolution)
60
61 # load confusion matrix, we may take log probability instead
62 if cfg.MAPPING.CONFUSION_MTX.LOAD_PATH != "":
63 confusion_matrix = ConfusionMatrix(load_path=cfg.MAPPING.CONFUSION_MTX.LOAD_PATH)
64 confusion_matrix.merge_labels(cfg.SRC_INDICES, cfg.DST_INDICES)
65 self.confusion_matrix = confusion_matrix.get_submatrix(cfg.LABELS, to_probability=True, use_log=False)
66 self.confusion_matrix = adjust_for_mapping(self.confusion_matrix, factor=cfg.MAPPING.REWEIGHT_FACTOR)
67 print('confusion_matrix:', self.confusion_matrix)
68 self.confusion_matrix = np.log(self.confusion_matrix)
69 # self.confusion_matrix = np.ones_like(self.confusion_matrix)
70 else:
71 # Use Identity confusion matrix
72 self.confusion_matrix = np.eye(len(self.label_names))
73
74
75 def mapping(self,

Callers 2

get_dynamic_mapFunction · 0.90
get_dynamic_mapFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected