Skip to content

Commit

Permalink
Merge pull request #568 from Farama-Foundation/fix-563
Browse files Browse the repository at this point in the history
Fix mobil's prediction of a vehicle's behaviour without knowledge of …
  • Loading branch information
eleurent authored Jan 27, 2024
2 parents 17059b8 + 6577ef6 commit 81c11d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion highway_env/vehicle/behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,10 @@ def acceleration_features(
) -> np.ndarray:
vt, dv, dp = 0, 0, 0
if ego_vehicle:
vt = ego_vehicle.target_speed - ego_vehicle.speed
vt = (
getattr(ego_vehicle, "target_speed", ego_vehicle.speed)
- ego_vehicle.speed
)
d_safe = (
self.DISTANCE_WANTED
+ np.maximum(ego_vehicle.speed, 0) * self.TIME_WANTED
Expand Down

0 comments on commit 81c11d6

Please sign in to comment.