Skip to content

Commit

Permalink
Fixed all gymnasium warnings
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
bpiwowar committed Nov 10, 2023
1 parent 442966f commit 9d3f3bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pystk2_gymnasium/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ def sort_closest(positions, *lists):
action = self.race.get_kart_action(kart_ix)
obs = {
"action": {
"steer": action.steer,
"brake": action.brake,
"nitro": action.nitro,
"drift": action.drift,
"rescue": action.rescue,
"fire": action.fire,
"acceleration": action.acceleration,
"steer": np.array([action.steer], dtype=np.float32),
"acceleration": np.array([action.acceleration], dtype=np.float32),
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ def test_env(name, use_ai):
done = False
state, *_ = env.reset()

while not done:
for _ in range(10):
ix += 1
action = env.action_space.sample()
# print(action)
state, reward, terminated, truncated, _ = env.step(action)
done = truncated or terminated
if done:
break
finally:
if env is not None:
env.close()

0 comments on commit 9d3f3bd

Please sign in to comment.