MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / tick

Method tick

leaderboard/team_code/base_agent.py:202–283  ·  view source on GitHub ↗
(self, input_data)

Source from the content-addressed store, hash-verified

200 ]
201
202 def tick(self, input_data):
203 self.step += 1
204
205 # affordances = self._get_affordances()
206
207 # traffic_lights = self._find_obstacle('*traffic_light*')
208 # stop_signs = self._find_obstacle('*stop*')
209
210 depth = {}
211 seg = {}
212
213 # bb_3d = self._get_3d_bbs(max_distance=self._3d_bb_distance)
214
215 bb_2d = {}
216
217 # for pos in ['front', 'left', 'right', 'rear']:
218 # seg_cam = 'seg_' + pos
219 # depth_cam = 'depth_' + pos
220 # _segmentation = np.copy(input_data[seg_cam][1][:, :, 2])
221
222 # depth[pos] = self._get_depth(input_data[depth_cam][1][:, :, :3])
223
224 # self._change_seg_tl(_segmentation, depth[pos], traffic_lights)
225 # self._change_seg_stop(_segmentation, depth[pos], stop_signs, seg_cam)
226
227 # bb_2d[pos] = self._get_2d_bbs(seg_cam, affordances, bb_3d, _segmentation)
228
229 # #self._draw_2d_bbs(_segmentation, bb_2d[pos])
230
231 # seg[pos] = _segmentation
232
233
234 rgb_front = cv2.cvtColor(input_data['rgb_front'][1][:, :, :3], cv2.COLOR_BGR2RGB)
235 # rgb_rear = cv2.cvtColor(input_data['rgb_rear'][1][:, :, :3], cv2.COLOR_BGR2RGB)
236 # rgb_left = cv2.cvtColor(input_data['rgb_left'][1][:, :, :3], cv2.COLOR_BGR2RGB)
237 # rgb_right = cv2.cvtColor(input_data['rgb_right'][1][:, :, :3], cv2.COLOR_BGR2RGB)
238 gps = input_data['gps'][1][:2]
239 speed = input_data['speed'][1]['speed']
240 compass = input_data['imu'][1][-1]
241
242 # depth_front = cv2.cvtColor(input_data['depth_front'][1][:, :, :3], cv2.COLOR_BGR2RGB)
243 # depth_left = cv2.cvtColor(input_data['depth_left'][1][:, :, :3], cv2.COLOR_BGR2RGB)
244 # depth_right = cv2.cvtColor(input_data['depth_right'][1][:, :, :3], cv2.COLOR_BGR2RGB)
245 # depth_rear = cv2.cvtColor(input_data['depth_rear'][1][:, :, :3], cv2.COLOR_BGR2RGB)
246
247 weather = self._weather_to_dict(self._world.get_weather())
248
249 # return {
250 # 'rgb_front': rgb_front,
251 # 'seg_front': seg['front'],
252 # 'depth_front': depth_front,
253 # '2d_bbs_front': bb_2d['front'],
254 # 'rgb_rear': rgb_rear,
255 # 'seg_rear': seg['rear'],
256 # 'depth_rear': depth_rear,
257 # '2d_bbs_rear': bb_2d['rear'],
258 # 'rgb_left': rgb_left,
259 # 'seg_left': seg['left'],

Callers

nothing calls this directly

Calls 1

_weather_to_dictMethod · 0.95

Tested by

no test coverage detected