Skip to content

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

Open

Description

@wulfebw

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

Activity

  1. tawheeler commented on Jan 30, 2017

    @tawheeler
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions