pub struct PathV2 {
steps: Vec<PathStepV2>,
req: PathRequest,
cost: Duration,
uber_turns: Vec<UberTurnV2>,
}
Expand description
A path between two endpoints for a particular mode. This representation is immutable and doesn’t prescribe specific lanes and turns to follow.
Fields
steps: Vec<PathStepV2>
req: PathRequest
cost: Duration
uber_turns: Vec<UberTurnV2>
Implementations
sourceimpl PathV2
impl PathV2
pub(crate) fn new(
steps: Vec<PathStepV2>,
req: PathRequest,
cost: Duration,
uber_turns: Vec<UberTurnV2>
) -> PathV2
sourcepub fn from_roads(
roads: Vec<DirectedRoadID>,
req: PathRequest,
cost: Duration,
uber_turns: Vec<UberTurnV2>,
map: &Map
) -> PathV2
pub fn from_roads(
roads: Vec<DirectedRoadID>,
req: PathRequest,
cost: Duration,
uber_turns: Vec<UberTurnV2>,
map: &Map
) -> PathV2
Vehicle implementations often just calculate the sequence of roads. Turn that into PathStepV2 here.
sourcepub fn get_req(&self) -> &PathRequest
pub fn get_req(&self) -> &PathRequest
The original PathRequest used to produce this path.
sourcepub fn get_steps(&self) -> &Vec<PathStepV2>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_steps(&self) -> &Vec<PathStepV2>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
All steps in this path.
sourcepub fn get_cost(&self) -> Duration
pub fn get_cost(&self) -> Duration
The time needed to perform this path. This time is not a lower bound; physically following the path might be faster. This time incorporates costs like using sub-optimal lanes, taking difficult turns, and crossing private roads (which are modelled with a large penalty!)
sourcepub fn estimate_duration(
&self,
map: &Map,
max_speed: Option<Speed>,
main_road_penalty: Option<f64>
) -> Duration
pub fn estimate_duration(
&self,
map: &Map,
max_speed: Option<Speed>,
main_road_penalty: Option<f64>
) -> Duration
Estimate how long following the path will take in the best case, assuming no traffic, delay at intersections, elevation, or penalties for crossing private roads. To determine the speed along each step, the agent’s optional max_speed must be known.
TODO Hack. The one use of this actually needs to apply main_road_penalty. We want to omit some penalties, but use others. Come up with a better way of expressing this.
sourcepub fn into_v1(self, map: &Map) -> Result<Path>
pub fn into_v1(self, map: &Map) -> Result<Path>
Transform a sequence of roads representing a path into the current lane-based path, by picking particular lanes and turns to use.