Skip to content

Commit

Permalink
fix action bug
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanyiLi committed May 24, 2023
1 parent b05d701 commit d37e299
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion metadrive/envs/real_data_envs/nuscenes_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
reset_used_time += time.time() - start_reset
reset_num += 1
for t in range(10000):
o, r, d, info = env.step([0, 0])
o, r, d, info = env.step([1, 0.88])
s += 1
if env.config["use_render"]:
env.render(text={"seed": env.current_seed,
Expand Down
4 changes: 2 additions & 2 deletions metadrive/obs/state_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def vehicle_state(self, vehicle):
clip((vehicle.steering / vehicle.MAX_STEERING + 1) / 2, 0.0, 1.0),

# The normalized actions at last steps
clip((vehicle.last_current_action[0][0] + 1) / 2, 0.0, 1.0),
clip((vehicle.last_current_action[0][1] + 1) / 2, 0.0, 1.0)
clip((vehicle.last_current_action[1][0] + 1) / 2, 0.0, 1.0),
clip((vehicle.last_current_action[1][1] + 1) / 2, 0.0, 1.0)
]

# Current angular acceleration (yaw rate)
Expand Down
3 changes: 3 additions & 0 deletions metadrive/tests/test_policy/test_expert_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def test_expert_in_intersection(render=False):


if __name__ == '__main__':
"""
LQY: I fixed a action bug in StateObservation, which may harm expert performance!
"""
# test_expert_in_intersection(True)
test_expert_without_traffic(True)
# test_expert_with_traffic(use_render=True)

0 comments on commit d37e299

Please sign in to comment.