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

get_neighbor_rear_along_lane returns neighbor fore when neighbor rear is in a different road segment #2

Open
wulfebw opened this issue Jan 27, 2017 · 1 comment

Comments

@wulfebw
Copy link
Collaborator

wulfebw commented Jan 27, 2017

When finding the rear neighbor using get_neighbor_rear_along_lane, the fore neighbor is selected rather than the rear in situations where the rear is in a different road segments. And more specifically, it primarily, and perhaps only, happens in the specific road segment considered in the attached notebook.

I think the bug is in the distance calculations, but I haven't figured it out yet. Included in the notebook is a copy of get_neighbor_rear_along_lane with a change that prevents the bug from occurring, but does so indirectly and so is not a great solution. The notebook also contains a minimal example demonstrating the bug.

get_neighbor_rear_along_lane.zip

@tawheeler
Copy link
Collaborator

tawheeler commented Jan 30, 2017

I think the issue has to do with:

elseif is_between_segments_hi(veh.state.posF.roadind.ind, lane.curve) &&
       is_in_entrances(roadway[tag_target], veh.state.posF.roadind.tag)
    distance_between_lanes = abs(roadway[tag_target].curve[1].pos - roadway[veh.state.posF.roadind.tag].curve[end].pos)
    s_adjust = -(roadway[veh.state.posF.roadind.tag].curve[end].s + distance_between_lanes)

elseif is_between_segments_lo(veh.state.posF.roadind.ind) &&
          is_in_exits(roadway[tag_target], veh.state.posF.roadind.tag)
    distance_between_lanes = abs(roadway[tag_target].curve[end].pos - roadway[veh.state.posF.roadind.tag].curve[1].pos)
    s_adjust = roadway[tag_target].curve[end].s + distance_between_lanes

The s_adjust that is computed seems to mess up the calculation. Need to spend more time going over this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants