Error in observations.py

Hi,

when running the flatland_2_0_example.py, the script crashes with the following error in observations.py.
The error is reproducible both on MacOS and on RedHat Linux

(flatland2-p3.7.0) mycode/>python flatland_2_0_example.py
Start episode...
1.4977648258209229
20
Traceback (most recent call last):
  File "flatland_2_0_example.py", line 123, in <module>
    next_obs, all_rewards, done, _ = env.step(action_dict)
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/flatland_rl-2.0.0-py3.7.egg/flatland/envs/rail_env.py", line 406, in step
    return self._get_observations(), self.rewards_dict, self.dones, info_dict
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/flatland_rl-2.0.0-py3.7.egg/flatland/envs/rail_env.py", line 627, in _get_observations
    self.obs_dict = self.obs_builder.get_many(list(range(self.get_num_agents())))
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/flatland_rl-2.0.0-py3.7.egg/flatland/envs/observations.py", line 82, in get_many
    observations = super().get_many(handles)
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/flatland_rl-2.0.0-py3.7.egg/flatland/core/env_observation_builder.py", line 55, in get_many
    observations[h] = self.get(h)
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/flatland_rl-2.0.0-py3.7.egg/flatland/envs/observations.py", line 234, in get
    self._explore_branch(handle, new_cell, branch_direction, 1, 1)
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/flatland_rl-2.0.0-py3.7.egg/flatland/envs/observations.py", line 331, in _explore_branch
    if int_position in np.delete(self.predicted_pos[predicted_time], handle, 0):
  File "<__array_function__ internals>", line 6, in delete
  File "/anaconda3/envs/flatland2-p3.7.0/lib/python3.7/site-packages/numpy/lib/function_base.py", line 4382, in delete
    "size %i" % (obj, axis, N))
IndexError: index 19 is out of bounds for axis 0 with size 19

Hi @marcoliver_gewaltig

Thank you for pointing this bug out. It is already fixed and pending to be merged.

Best regards,
The Flatland Team

1 Like