Skip to content

Commit

Permalink
Merge pull request #11 from sisl/neighbor-bugfix
Browse files Browse the repository at this point in the history
Fixing a bug in find_neighbor
  • Loading branch information
MaximeBouton committed Aug 10, 2020
2 parents b1fc10f + 5dd74b7 commit b94923f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Project.toml
@@ -1,7 +1,7 @@
name = "AutomotiveSimulator"
uuid = "6aa42d20-6c96-11ea-1103-339224409280"
repo = "https://github.com/sisl/AutomotiveSimulator.jl.git"
version = "0.1.0"
version = "0.1.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand All @@ -21,7 +21,7 @@ Parameters = "0.12"
Reexport = "0.2"
StaticArrays = "0.12"
Tricks = "0.1"
julia = "1.3, 1.4"
julia = "1.3, 1.4, 1.5"

[extras]
AutomotiveVisualization = "0faf7fd0-6c98-11ea-1740-03605baa3b07"
Expand Down
8 changes: 6 additions & 2 deletions src/feature-extraction/neighbors_features.jl
Expand Up @@ -57,6 +57,7 @@ const VEHICLE_TARGET_POINT_CENTER = VehicleTargetPointCenter()
find_neighbor(scene::Scene, roadway::Roawday, ego::Entity; kwargs...)
Search through lanes and road segments to find a neighbor of `ego` in the `scene`.
Returns a `NeighborLongitudinalResult` object with the index of the neighbor in the scene and its relative distance.
# Arguments
Expand All @@ -81,15 +82,18 @@ function find_neighbor(scene::Scene, roadway::Roadway, ego::Entity{S,D,I};
ids_to_ignore::Union{Nothing, Set{I}} = nothing) where {S,D,I}


if lane == nothing
if lane === nothing
return NeighborLongitudinalResult(nothing, max_distance)
elseif get_lane(roadway, ego).tag == lane.tag
tag_start = lane.tag
s_start = posf(ego.state).s
else # project ego on desired lane
roadproj = proj(posg(ego.state), lane, roadway)
roadind = RoadIndex(roadproj)
tag_start = roadproj.tag
s_start = roadway[roadind].s
end
s_base = posf(ego.state).s + targetpoint_delta(targetpoint_ego, ego)
s_base = s_start + targetpoint_delta(targetpoint_ego, ego)

tag_target = tag_start
best_ind = nothing
Expand Down

2 comments on commit b94923f

@MaximeBouton
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/19256

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" b94923ffb67152a6d2d0f3dd5c25ba9090a036bc
git push origin v0.1.1

Please sign in to comment.