Open Adaickalavan opened 2 years ago
This appears to be an issue with translating to Gym
reset that we can have an agent done before reaching the first Gym
step. I am not quite sure how to deal with this issue. I think Gym
requires a valid initial state to be available after reset so the requirement in order to satisfy Gym
might be to force the vehicle into a valid initial state based on the done_criteria
or to warn and defer the done until the first Gym
step.
BUG REPORT
Let
done_criteria
to includeon_shoulder=True
.https://github.com/huawei-noah/SMARTS/blob/1258f7e671f2e4bc2daefecb99fed816b1b46ccd/smarts/core/smarts.py#L350-L356
The smarts
reset
code is shown above. Here, when the vehicle appears and returnsobservations_for_ego
, it is sometimes alreadydone=True
as theobservations_for_ego.events.on_shoulder=True
. Simply put, the vehicle appeared on road shoulder. Hence, the subsequent first call tostep
afterreset
will throw error as the agent is alreadydone
.Furthermore,
self._step_count
is incremented in every call toself.step({})
inside thereset
function, causing a non-zero step count right afterreset
returns. Hence, agents can become done earlier than the maximum-steps-per-episode configuration.SMARTS version 0.4.18.
Steps to reproduce the bug Set
done_criteria
to includeon_shoulder=True
.Resulting and expected behaviour Vehicle should preferably not start on road shoulder.
Impact [If known] If this is not fixed, then
done_criteria
cannot includeon_shoulder
condition.