Skip to content

Commit

Permalink
[Bugfix] Envision 0 length lane crash (#1876)
Browse files Browse the repository at this point in the history
* Fix envision crash

* Shift formatting to data formatter.

* Update changelog
  • Loading branch information
Gamenot authored Feb 19, 2023
1 parent 798a94d commit 02b0cec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Copy and pasting the git commit messages is __NOT__ enough.
- Made the heading input relative to the current heading in `RelativeTargetPose` action space.
### Deprecated
### Fixed
- Issue where a 0 length lane caused `envision` to crash.
- Fixed an issue where `Feature.type_specific_info` was calling a non-existant method.
### Removed
### Security

Expand Down
2 changes: 2 additions & 0 deletions envision/data_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ def _format_traffic_actor(obj, data_formatter: EnvisionDataFormatter):
for l_point in data_formatter.layer(obj.point_cloud):
data_formatter.add(l_point, op=Operation.FLATTEN)
for geo in data_formatter.layer(obj.mission_route_geometry):
if len(geo) == 0:
continue
for route_point in data_formatter.layer(geo):
data_formatter.add(route_point, op=Operation.FLATTEN)
assert type(obj.actor_type) is TrafficActorType
Expand Down
2 changes: 1 addition & 1 deletion smarts/core/sumo_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def type_specific_info(self) -> Optional[Any]:
# the only type we currently handle is FIXED_LOC_SIGNAL
in_lane, to_lane, _ = self._feat_data
via_id = in_lane.getConnection(to_lane).getViaLaneID()
return self.lane_by_id(via_id)
return self._map.lane_by_id(via_id)

def min_dist_from(self, point: Point) -> float:
return np.linalg.norm(self.geometry[0].as_np_array - point.as_np_array)
Expand Down

0 comments on commit 02b0cec

Please sign in to comment.