mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 19:50:17 +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_*
|
||||
dist
|
||||
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.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 \
|
||||
or measurements.player_measurements.collision_pedestrians != 0 \
|
||||
or measurements.player_measurements.collision_other != 0
|
||||
@@ -381,8 +384,6 @@ class CarlaEnvironment(Environment):
|
||||
self.state['high_level_command'] = directions
|
||||
|
||||
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.state['measurements'] = np.array(self.measurements)
|
||||
|
||||
@@ -71,10 +71,6 @@ def create_dataset(dataset_root, output_path):
|
||||
observations = train_set['rgb'][:] # forward camera
|
||||
measurements = np.expand_dims(train_set['targets'][:, 10], -1) # forward speed
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user