Skip to content

Commit

Permalink
Fix visualisation bug from unnormalising ego-vehicle out of feature b…
Browse files Browse the repository at this point in the history
…ounds

see #79
  • Loading branch information
eleurent authored Mar 4, 2023
1 parent 35216ba commit 02e0303
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rl_agents/agents/deep_q_network/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def compute_vehicles_attention(cls, agent, state):
if not obs_type.absolute and v_index > 0:
v_position += agent.env.unwrapped.vehicle.position
vehicle = min(agent.env.road.vehicles, key=lambda v: np.linalg.norm(v.position - v_position))
vehicle = agent.env.unwrapped.vehicle if v_index == 0 else vehicle
v_attention[vehicle] = attention[:, v_index]
return v_attention

Expand Down

0 comments on commit 02e0303

Please sign in to comment.