mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 11:40:18 +01:00
CARLA cleanups + calculating the distance to goal
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -21,3 +21,7 @@ contrib
|
|||||||
test_log_*
|
test_log_*
|
||||||
dist
|
dist
|
||||||
datasets
|
datasets
|
||||||
|
.cache
|
||||||
|
.pytest_cache
|
||||||
|
core
|
||||||
|
trace_test*
|
||||||
|
|||||||
@@ -359,6 +359,9 @@ class CarlaEnvironment(Environment):
|
|||||||
measurements.player_measurements.transform.location.y,
|
measurements.player_measurements.transform.location.y,
|
||||||
measurements.player_measurements.transform.location.z]
|
measurements.player_measurements.transform.location.z]
|
||||||
|
|
||||||
|
self.distance_from_goal = np.linalg.norm(np.array(self.location[:2]) -
|
||||||
|
[self.current_goal.location.x, self.current_goal.location.y])
|
||||||
|
|
||||||
is_collision = measurements.player_measurements.collision_vehicles != 0 \
|
is_collision = measurements.player_measurements.collision_vehicles != 0 \
|
||||||
or measurements.player_measurements.collision_pedestrians != 0 \
|
or measurements.player_measurements.collision_pedestrians != 0 \
|
||||||
or measurements.player_measurements.collision_other != 0
|
or measurements.player_measurements.collision_other != 0
|
||||||
@@ -381,8 +384,6 @@ class CarlaEnvironment(Environment):
|
|||||||
self.state['high_level_command'] = directions
|
self.state['high_level_command'] = directions
|
||||||
|
|
||||||
if (measurements.game_timestamp >= self.episode_max_time) or is_collision:
|
if (measurements.game_timestamp >= self.episode_max_time) or is_collision:
|
||||||
# screen.success('EPISODE IS DONE. GameTime: {}, Collision: {}'.format(str(measurements.game_timestamp),
|
|
||||||
# str(is_collision)))
|
|
||||||
self.done = True
|
self.done = True
|
||||||
|
|
||||||
self.state['measurements'] = np.array(self.measurements)
|
self.state['measurements'] = np.array(self.measurements)
|
||||||
|
|||||||
@@ -71,10 +71,6 @@ def create_dataset(dataset_root, output_path):
|
|||||||
observations = train_set['rgb'][:] # forward camera
|
observations = train_set['rgb'][:] # forward camera
|
||||||
measurements = np.expand_dims(train_set['targets'][:, 10], -1) # forward speed
|
measurements = np.expand_dims(train_set['targets'][:, 10], -1) # forward speed
|
||||||
actions = train_set['targets'][:, :3] # steer, gas, brake
|
actions = train_set['targets'][:, :3] # steer, gas, brake
|
||||||
# actions[:, :2] = actions[:, 1:3]
|
|
||||||
# actions[:, 2] = train_set['targets'][:, 0] # gas, brake, steer
|
|
||||||
# actions[:, 1] -= actions[:, 2]
|
|
||||||
# actions = actions[:, :2][:, ::-1]
|
|
||||||
|
|
||||||
high_level_commands = train_set['targets'][:, 24].astype('int') - 2 # follow lane, left, right, straight
|
high_level_commands = train_set['targets'][:, 24].astype('int') - 2 # follow lane, left, right, straight
|
||||||
|
|
||||||
@@ -104,4 +100,4 @@ if __name__ == "__main__":
|
|||||||
default='carla_train_set_replay_buffer.p')
|
default='carla_train_set_replay_buffer.p')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
create_dataset(args.dataset_root, args.output_path)
|
create_dataset(args.dataset_root, args.output_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user