MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / setup

Method setup

leaderboard/team_code/base_agent.py:21–63  ·  view source on GitHub ↗
(self, path_to_conf_file)

Source from the content-addressed store, hash-verified

19
20class BaseAgent(autonomous_agent.AutonomousAgent):
21 def setup(self, path_to_conf_file):
22 self.track = autonomous_agent.Track.SENSORS
23 self.config_path = path_to_conf_file
24 self.step = -1
25 self.wall_start = time.time()
26 self.initialized = False
27
28 self._sensor_data = {
29 'width': 400,
30 'height': 300,
31 'fov': 100
32 }
33
34 self._3d_bb_distance = 50
35 self.weather_id = None
36
37 self.save_path = None
38
39 if SAVE_PATH is not None:
40 now = datetime.datetime.now()
41 string = pathlib.Path(os.environ['ROUTES']).stem + '_'
42 string += '_'.join(map(lambda x: '%02d' % x, (now.month, now.day, now.hour, now.minute, now.second)))
43
44 print (string)
45
46 self.save_path = pathlib.Path(os.environ['SAVE_PATH']) / string
47 self.save_path.mkdir(parents=True, exist_ok=False)
48
49 for sensor in self.sensors():
50 if hasattr(sensor, 'save') and sensor['save']:
51 (self.save_path / sensor['id']).mkdir()
52
53 (self.save_path / '3d_bbs').mkdir(parents=True, exist_ok=True)
54 (self.save_path / 'affordances').mkdir(parents=True, exist_ok=True)
55 (self.save_path / 'measurements').mkdir(parents=True, exist_ok=True)
56 (self.save_path / 'lidar').mkdir(parents=True, exist_ok=True)
57 (self.save_path / 'semantic_lidar').mkdir(parents=True, exist_ok=True)
58 (self.save_path / 'topdown').mkdir(parents=True, exist_ok=True)
59
60 for pos in ['front', 'left', 'right', 'rear']:
61 for sensor_type in ['rgb', 'seg', 'depth', '2d_bbs']:
62 name = sensor_type + '_' + pos
63 (self.save_path / name).mkdir()
64
65 def _init(self):
66 self._command_planner = RoutePlanner(7.5, 25.0, 257)

Callers

nothing calls this directly

Calls 1

sensorsMethod · 0.95

Tested by

no test coverage detected