Remove _broken_path_v2_to_v1 for now.
@@ -124,84 +124,3 @@ fn find_uber_turns(
assert_eq!(num_uts, result.len());
result
}
-
-// TODO This is an attempt that looks at windows of 2 roads at a time to pick particular lanes and
-// turns. It doesn't work in most cases with multiple lane choices -- I think we need at least a
-// window of 3 roads. I'll write that function in the future, for the simulation layer to use
-// "lazily".
-fn _broken_path_v2_to_v1(
- req: PathRequest,
- mut road_steps: Vec<DirectedRoadID>,
- map: &Map,
-) -> Result<Path> {
- let mut path_steps = Vec::new();
-
- // Pick the starting lane.
- {
- let lanes = road_steps.remove(0).lanes(req.constraints, map);
- // TODO During the transition, try to use the original requested start lane. Relax this
- // later to produce more realistic paths!
- if !lanes.contains(&req.start.lane()) {
- bail!(
- "path_v2_to_v1 found a case where we can't start at the requested lane: {}",
- req
- );
- }
- path_steps.push(PathStep::Lane(req.start.lane()));
- }
- let last_road = map.get_l(req.end.lane()).get_directed_parent();
-
- for road in road_steps {
- let prev_lane = if let Some(PathStep::Lane(l)) = path_steps.last() {
- *l
- } else {
- unreachable!()
- };
-
- let mut current_lanes = road.lanes(req.constraints, map);
- // Filter current_lanes based on available turns.
- let parent = map.get_l(prev_lane).dst_i;
- current_lanes.retain(|dst| {
- map.maybe_get_t(TurnID {
- parent,
- src: prev_lane,
- dst: *dst,
- })
- .is_some()
- });
- if current_lanes.is_empty() {
- error!("Lookahead failed. Req: {}", req);
- error!("Path so far:");
- for x in &path_steps {
- error!("- {:?}", x);
- }
-
- bail!(
- "path_v2_to_v1 found a case where lookahead failed at {}: {}",
- parent,
- req
- );
- }
- if road == last_road {
- current_lanes.retain(|l| *l == req.end.lane());
- }
-
- // TODO We could include the old lane-changing penalties here, but I'm not sure it's worth
- // the complication. The simulation layer will end up tuning those anyway.
- let next_lane = current_lanes[0];
- path_steps.push(PathStep::Turn(TurnID {
- parent,
- src: prev_lane,
- dst: next_lane,
- }));
- path_steps.push(PathStep::Lane(next_lane));
- }
-
- // Sanity check we end in the right place.
- assert_eq!(
- Some(PathStep::Lane(req.end.lane())),
- path_steps.last().cloned()
- );
- // TODO No uber-turns yet!
- Ok(Path::new(map, path_steps, req, Vec::new()))
-}
