Closed x15079 closed 5 years ago
This bug is very hard to trace. I am currently looking into it.
Could it be that the agent somehow manages to be on a tile that is not driveable?
This is the tile, when the assertion is violated:
{'coords': (1, 3), 'kind': 'asphalt', 'angle': 0, 'drivable': False, 'texture': <gym_duckietown.graphics.Texture object at 0x1329fd0f0>, 'color': array([0.97397976, 0.83174457, 1.14550171])}
And this is the position of the agent:
[0.61297318 0. 2.43493106]
I did a small workaround. I just end the episode when this error occurs. I am very hesitant to create a pull request. Reason: This is treating the problem's symptoms.
Unfortunately, we haven't been able to find the cause for a few months now. @maximecb I had another user email me about this issue - should we just end the episode? I can't always reproduce this but I can devote some time early next week to finding / fixing.
According to the trace, this occurs in a call to get_agent_info()
, which is called in the step()
function, after update_physics()
. In other words, the agent position is updated, and then get_lane_pos()
is called. I think it's possible that the action puts the agent position outside of a drivable tile.
The cleanest fix IMO would be to add an extra check, call self._drivable_pos(pos)
in get_agent_info()
to check that the position is on a drivable tile before calling get_lane_pos()
.
Okay I will fix it - sorry I should have taken a closer look.
Thank you!
use python3 pytorch_rl/main.py --no-vis --・・・ please help me AssertionError
Traceback (most recent call last): File "pytorch_rl/main.py", line 298, in
main()
File "pytorch_rl/main.py", line 130, in main
obs, reward, done, info = envs.step(cpu_actions)
File "/home/ubuntu/gym-duckietown/pytorch_rl/vec_env/init.py", line 59, in step
return self.step_wait()
File "/home/ubuntu/gym-duckietown/pytorch_rl/vec_env/dummy_vec_env.py", line 16, in step_wait
results = [env.step(a) for (a,env) in zip(self.actions, self.envs)]
File "/home/ubuntu/gym-duckietown/pytorch_rl/vec_env/dummy_vec_env.py", line 16, in
results = [env.step(a) for (a,env) in zip(self.actions, self.envs)]
File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/core.py", line 304, in step
observation, reward, done, info = self.env.step(action)
File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/core.py", line 304, in step
observation, reward, done, info = self.env.step(action)
File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/core.py", line 332, in step
return self.env.step(action)
File "/home/ubuntu/gym-duckietown/gym_duckietown/envs/duckietown_env.py", line 75, in step
obs, reward, done, info = Simulator.step(self, vels)
File "/home/ubuntu/gym-duckietown/gym_duckietown/simulator.py", line 1196, in step
misc = self.get_agent_info()
File "/home/ubuntu/gym-duckietown/gym_duckietown/simulator.py", line 1154, in get_agent_info
lp = self.get_lane_pos(pos, angle)
File "/home/ubuntu/gym-duckietown/gym_duckietown/simulator.py", line 979, in get_lane_pos
assert point is not None
AssertionError