Skip to content
Snippets Groups Projects
Commit a3b5871f authored by Christian Eichenberger's avatar Christian Eichenberger :badminton:
Browse files

Merge branch '275_speed_epsilon' into 'master'

this resolves #275. Now we check isclose to 1.0 instead of = 1.0

Closes #275

See merge request flatland/flatland!264
parents d086a29a b8d91ac3
No related branches found
No related tags found
No related merge requests found
...@@ -617,7 +617,8 @@ class RailEnv(Environment): ...@@ -617,7 +617,8 @@ class RailEnv(Environment):
# transition_action_on_cellexit if the cell is free. # transition_action_on_cellexit if the cell is free.
if agent.moving: if agent.moving:
agent.speed_data['position_fraction'] += agent.speed_data['speed'] agent.speed_data['position_fraction'] += agent.speed_data['speed']
if agent.speed_data['position_fraction'] >= 1.0: if agent.speed_data['position_fraction'] > 1.0 or np.isclose(agent.speed_data['position_fraction'], 1.0,
rtol=1e-03):
# Perform stored action to transition to the next cell as soon as cell is free # Perform stored action to transition to the next cell as soon as cell is free
# Notice that we've already checked new_cell_valid and transition valid when we stored the action, # Notice that we've already checked new_cell_valid and transition valid when we stored the action,
# so we only have to check cell_free now! # so we only have to check cell_free now!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment