def _compute_obstacle_poses(self):
    obstacle_dists = []
    obstacle_lanes = []
    lane_choices = (self.track_data.inner_lane, self.track_data.outer_lane)
    if self.object_locations:
        for object_location in self.object_locations:
            object_location = object_location.split(',')
            obstacle_dists.append((float(object_location[0]) * self.track_data.center_line.length))
            obstacle_lanes.append(lane_choices[(int(object_location[1]) == (- 1))])
    else:
        obstacle_start_dist = self.min_obstacle_dist
        obstacle_end_dist = (self.track_data.center_line.length - 1.0)
        obstacle_dists = np.linspace(obstacle_start_dist, obstacle_end_dist, self.num_obstacles)
        if self.randomize:
            i_obstacle = list(range(self.num_obstacles))
            random.shuffle(i_obstacle)
            for i in i_obstacle:
                lo = (obstacle_start_dist if (i == 0) else (obstacle_dists[(i - 1)] + self.min_obstacle_dist))
                hi = (obstacle_end_dist if (i == (self.num_obstacles - 1)) else (obstacle_dists[(i + 1)] - self.min_obstacle_dist))
                if (lo < hi):
                    obstacle_dists[i] = random.uniform(lo, hi)
            for _ in obstacle_dists:
                use_outer_lane = random.choice((False, True))
                obstacle_lanes.append(lane_choices[use_outer_lane])
        else:
            use_outer_lane = False
            for _ in obstacle_dists:
                obstacle_lanes.append(lane_choices[use_outer_lane])
                use_outer_lane = (not use_outer_lane)
    obstacle_poses = []
    for (obstacle_dist, obstacle_lane) in zip(obstacle_dists, obstacle_lanes):
        obstacle_pose = obstacle_lane.interpolate_pose(obstacle_lane.project(self.track_data.center_line.interpolate(obstacle_dist)))
        if self.use_bot_car:
            obstacle_pose.position.z = BOT_CAR_Z
        else:
            obstacle_pose.position.z = OBSTACLE_Z
        obstacle_poses.append(obstacle_pose)
    return obstacle_poses
def _compute_obstacle_poses(self):
    obstacle_dists = []
    obstacle_lanes = []
    lane_choices = (self.track_data.inner_lane, self.track_data.outer_lane)
    if self.object_locations:
        for object_location in self.object_locations:
            object_location = object_location.split(',')
            obstacle_dists.append((float(object_location[0]) * self.track_data.center_line.length))
            obstacle_lanes.append(lane_choices[(int(object_location[1]) == (- 1))])
    else:
        obstacle_start_dist = self.min_obstacle_dist
        obstacle_end_dist = (self.track_data.center_line.length - 1.0)
        obstacle_dists = np.linspace(obstacle_start_dist, obstacle_end_dist, self.num_obstacles)
        if self.randomize:
            i_obstacle = list(range(self.num_obstacles))
            random.shuffle(i_obstacle)
            for i in i_obstacle:
                lo = (obstacle_start_dist if (i == 0) else (obstacle_dists[(i - 1)] + self.min_obstacle_dist))
                hi = (obstacle_end_dist if (i == (self.num_obstacles - 1)) else (obstacle_dists[(i + 1)] - self.min_obstacle_dist))
                if (lo < hi):
                    obstacle_dists[i] = random.uniform(lo, hi)
            for _ in obstacle_dists:
                use_outer_lane = random.choice((False, True))
                obstacle_lanes.append(lane_choices[use_outer_lane])
        else:
            use_outer_lane = False
            for _ in obstacle_dists:
                obstacle_lanes.append(lane_choices[use_outer_lane])
                use_outer_lane = (not use_outer_lane)
    obstacle_poses = []
    for (obstacle_dist, obstacle_lane) in zip(obstacle_dists, obstacle_lanes):
        obstacle_pose = obstacle_lane.interpolate_pose(obstacle_lane.project(self.track_data.center_line.interpolate(obstacle_dist)))
        if self.use_bot_car:
            obstacle_pose.position.z = BOT_CAR_Z
        else:
            obstacle_pose.position.z = OBSTACLE_Z
        obstacle_poses.append(obstacle_pose)
    return obstacle_poses