When running gym-duckietown with dynamic obstacles (duckiebots), the episode terminates when the ego-robot moves to the starting pose of an obstacle duckiebot, even though the later one moved away.
On the animation below, the robot moving diagonally is the ego-robot, and the other moving robot is a dynamic obstacle, an NPC duckiebot. The episode was terminated when the ego-robot reached the starting pose of the NPC-robot.
Reproducing the incorrect behaviour
Run the following script on the latest version of gym-duckietown from the daffy or daffy-aido4 branches.
import time
import numpy as np
from gym_duckietown.simulator import Simulator
env = Simulator(map_name="loop_dyn_duckiebots", domain_rand=False)
env.user_tile_start = [0, 0]
env.start_pose = [[env.road_tile_size * 1.33, 0, env.road_tile_size * 4.75], -np.pi*0.2]
env.reset()
env.render('top_down')
time.sleep(1)
done = False
while not done:
_, _, done, _ = env.step(np.array([0.25, 0.25]))
env.render('top_down')
Or run the following script (in the same version):
Incorrect behaviour
When running gym-duckietown with dynamic obstacles (duckiebots), the episode terminates when the ego-robot moves to the starting pose of an obstacle duckiebot, even though the later one moved away.
On the animation below, the robot moving diagonally is the ego-robot, and the other moving robot is a dynamic obstacle, an NPC duckiebot. The episode was terminated when the ego-robot reached the starting pose of the NPC-robot.
Reproducing the incorrect behaviour
Run the following script on the latest version of gym-duckietown from the
daffy
ordaffy-aido4
branches.Or run the following script (in the same version):
Cause of the incorrect behaviour
Centres, corners, etc. of dynamic obstacles are added to the list of collidable objects when the objects are loaded. Dynamic duckiebots than move away from their starting pose, but their initial centres, corners, etc. remain in the corresponding collidable object lists, which are used for collision checking. See: https://github.com/duckietown/gym-duckietown/blob/1c0919157f2e70b8c143b5e711b23d0cf5a76ab8/src/gym_duckietown/simulator.py#L751-L757 and: https://github.com/duckietown/gym-duckietown/blob/1c0919157f2e70b8c143b5e711b23d0cf5a76ab8/src/gym_duckietown/simulator.py#L1198-L1227