Skip to content

Commit c72734b

Browse files
committed
Update
1 parent da2308d commit c72734b

File tree

6 files changed

+6
-85
lines changed

6 files changed

+6
-85
lines changed

carl/envs/gymnasium/box2d/carl_bipedal_walker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import numpy as np
43
from Box2D.b2 import edgeShape, fixtureDef, polygonShape
54
from gymnasium.envs.box2d import bipedal_walker
65
from gymnasium.envs.box2d import bipedal_walker as bpw

carl/envs/gymnasium/box2d/carl_lunarlander.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import Box2D
43
from Box2D.b2 import vec2
54
from gymnasium.envs.box2d import lunar_lander
65
from gymnasium.envs.box2d.lunar_lander import LunarLander

carl/envs/gymnasium/box2d/carl_vehicle_racing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,3 @@ def _update_context(self) -> None:
222222
self.env: CustomCarRacing
223223
vehicle_class_index = self.context["VEHICLE_ID"]
224224
self.env.vehicle_class = PARKING_GARAGE[vehicle_class_index]
225-
print(self.env.vehicle_class)

examples/demo_carracing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def register_input():
4343
a[2] = 0
4444

4545
contexts = {i: {"VEHICLE_ID": i} for i in range(len(VEHICLE_NAMES))}
46+
CARLVehicleRacing.render_mode = "human"
4647
env = CARLVehicleRacing(contexts=contexts)
4748

4849
record_video = False
@@ -62,14 +63,14 @@ def register_input():
6263
restart = False
6364
while True:
6465
register_input()
65-
s, r, done, info = env.step(a)
66+
s, r, truncated, terminated, info = env.step(a)
6667
time.sleep(0.025)
6768
total_reward += r
68-
if steps % 200 == 0 or done:
69+
if steps % 200 == 0 or truncated or terminated:
6970
print("\naction " + str(["{:+0.2f}".format(x) for x in a]))
7071
print("step {} total_reward {:+0.2f}".format(steps, total_reward))
7172
steps += 1
72-
isopen = env.render()
73-
if done or restart or not isopen:
73+
env.render()
74+
if truncated or terminated or restart or not isopen:
7475
break
7576
env.close()

examples/demo_heuristic_bipedalwalker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def demo_heuristic(env: CARLBipedalWalker | bipedal_walker.BipedalWalker) -> Non
9292
CARLBipedalWalker.render_mode = "human"
9393
env = CARLBipedalWalker(
9494
# Play with leg height :)
95-
contexts = {0: {"LEG_H": 4}}
95+
contexts={0: {"LEG_H": 4}}
9696
)
9797
demo_heuristic(env)
9898
env.close()

examples/play_car_racing.py

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)