Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source phantom weight to first segment when merging legs #4949

Merged
merged 9 commits into from
Mar 13, 2018

Conversation

danpat
Copy link
Member

@danpat danpat commented Mar 10, 2018

Issue

This is a fix for #4948, where, when we merge legs together because of waypoints=1,N, the first segment of each leg needs to have the source phantom forward_weight/duration value added (it is normally subtracted from the first segment, because it's only part of the road). The lack of this was leading to durations that were too short, and weight, speed, and duration annotations containing incorrect values.

Tasklist

/cc @bsudekum

// source phantom. We need to add those values back so that the total
// edge weight is correct
last_segment[old_size].weight_until_turn +=
leggy_result.segment_end_coordinates[i].source_phantom.forward_weight;
Copy link
Contributor

@oxidase oxidase Mar 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the source phantom is traversed in reverse then the reverse weight must be used:

leggy_result.source_traversed_in_reverse[i] ?
leggy_result.segment_end_coordinates[i].source_phantom.reverse_weight :
leggy_result.segment_end_coordinates[i].source_phantom.forward_weight;

Copy link
Contributor

@oxidase oxidase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
LGTM with adjustments for phantom nodes traversed in the reversed direction.

Given a grid size of 10 meters
Given the node map
"""
a--1-b2cd-3--e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suggest to make forward and reverse phantom node weights for bc segment different as a--1-b2-cd-3--e

| generate_hints | false |
When I match I should get
| trace | geometry | a:duration | a:weight | duration |
| 123 | 1.000135,1,1.000225,1,1.000315,1,1.00036,1,1.00045,1 | 1:1:0.5:1 | 1:1:0.5:1 | 3.5 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and here add a test for a reversed trace as 321

@@ -113,15 +114,39 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
const std::vector<DatasourceID> forward_datasources =
facade.GetUncompressedForwardDatasources(target_geometry_id);

// FIXME if source and target phantoms are on the same segment then duration and weight
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray, I fixed a FIXME.

@danpat danpat added this to the 5.16.4 milestone Mar 13, 2018
@danpat
Copy link
Member Author

danpat commented Mar 13, 2018

I think this is ready to go as soon as Travis passes (there may be some (incorrect) tests affected by the fixed annotation calculation logic).

@TheMarex
Copy link
Member

@danpat seems like there is a unit test failing here. 🤔

@danpat danpat dismissed oxidase’s stale review March 13, 2018 18:30

All review points addressed.

@danpat danpat merged commit f7775f5 into master Mar 13, 2018
@danpat danpat deleted the fix_missing_phantom_weight branch March 13, 2018 18:31
danpat added a commit that referenced this pull request Mar 13, 2018
Fix annotation values for annotations on edges where phantom nodes are snapped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants