-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathexample_adapter.py
36 lines (30 loc) · 1.08 KB
/
example_adapter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gym
import utils
def get_observation_adapter(obs_stack_size):
stack_size = obs_stack_size
# look_ahead = 10
closest_neighbor_num = 6
img_resolution = 40
observe_lane_num = 3
subscribed_features = dict(
# distance_to_center=(stack_size, 1),
ego_pos=(stack_size, 2),
heading=(stack_size, 1),
speed=(stack_size, 1),
neighbor=(stack_size, closest_neighbor_num * 4), # dist, speed, ttc
# heading_errors=(stack_size, look_ahead),
# steering=(stack_size, 1),
# ego_lane_dist_and_speed=(stack_size, observe_lane_num + 1),
# img_gray=(stack_size, img_resolution, img_resolution) if use_rgb else False,
)
observation_space = gym.spaces.Dict(
utils.subscribe_features(**subscribed_features)
)
observation_adapter = utils.get_observation_adapter(
observation_space,
# look_ahead=look_ahead,
observe_lane_num=observe_lane_num,
resize=(img_resolution, img_resolution),
closest_neighbor_num=closest_neighbor_num,
)
return observation_adapter