Skip to content
Snippets Groups Projects
Commit 2b0cbd96 authored by spiglerg's avatar spiglerg
Browse files

Merge branch '115_agent_not_moving' into 'master'

updated agent.moving behavior to give correct value when agent is blocked

See merge request flatland/flatland!118
parents 77a5f1e9 9432caf9
No related branches found
No related tags found
No related merge requests found
......@@ -320,15 +320,17 @@ class RailEnv(Environment):
# Perform stored action to transition to the next cell
# Now 'transition_action_on_cellexit' will be guaranteed to be valid; it was checked on entering
# the cell
cell_free, new_cell_valid, new_direction, new_position, transition_valid = \
self._check_action_on_agent(agent.speed_data['transition_action_on_cellexit'], agent)
# Check that everything is still fee and that the agent can move
if all([new_cell_valid, transition_valid, cell_free]):
agent.position = new_position
agent.direction = new_direction
agent.speed_data['position_fraction'] = 0.0
else:
# If the agent cannot move due to any reason, we set its state to not moving.
agent.moving = False
if np.equal(agent.position, agent.target).all():
self.dones[i_agent] = True
......
......@@ -70,7 +70,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5a05a5f0569846dfa58fc6cfc222619a",
"model_id": "68a566e6228d40398ea8432582880311",
"version_major": 2,
"version_minor": 0
},
......
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