Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gym/envs/box2d/car_racing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _contact(self, contact, begin):
return

# inherit tile color from env
tile.color = self.env.norm_road_color / 255
tile.color = self.env.road_color / 255
if not obj or "tiles" not in obj.__dict__:
return
if begin:
Expand Down Expand Up @@ -132,7 +132,7 @@ class CarRacing(gym.Env, EzPickle):
In this scenario, the background and track colours are different on every reset.

### Version History
- v1: Current version (0.24.0)
- v1: Change track completion logic and add domain randomization (0.24.0)
- v0: Original version

### References
Expand Down Expand Up @@ -196,7 +196,7 @@ def _destroy(self):
def _init_colors(self):
if self.domain_randomize:
# domain randomize the bg and grass colour
self.norm_road_color = self.np_random.uniform(0, 210, size=3)
self.road_color = self.np_random.uniform(0, 210, size=3)

self.bg_color = self.np_random.uniform(0, 210, size=3)

Expand All @@ -205,7 +205,7 @@ def _init_colors(self):
self.grass_color[idx] += 20
else:
# default colours
self.norm_road_color = np.array([102, 102, 102])
self.road_color = np.array([102, 102, 102])
self.bg_color = np.array([102, 204, 102])
self.grass_color = np.array([102, 230, 102])

Expand Down Expand Up @@ -365,7 +365,7 @@ def _create_track(self):
t = self.world.CreateStaticBody(fixtures=self.fd_tile)
t.userData = t
c = 0.01 * (i % 3) * 255
t.color = self.norm_road_color + c
t.color = self.road_color + c
t.road_visited = False
t.road_friction = 1.0
t.idx = i
Expand Down