Skip to content

Commit

Permalink
Convert env. calls to unwrapped and use make_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmadAmine998 committed Jan 27, 2025
1 parent 10c5423 commit e5d8198
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/run_in_empty_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def main():
planner = PurePursuitPlanner(track=track, wb=0.17145 + 0.15875)

# rendering callbacks
env.add_render_callback(track.raceline.render_waypoints)
env.add_render_callback(planner.render_lookahead_point)
env.unwrapped.add_render_callback(track.raceline.render_waypoints)
env.unwrapped.add_render_callback(planner.render_lookahead_point)

# simulation
obs, info = env.reset()
Expand Down
12 changes: 6 additions & 6 deletions tests/test_f110_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def test_configure_method(self):
# create a base environment and use configure() to change the width
config_ext = {"params": {"width": 15.0}}
base_env = self._make_env()
base_env.configure(config=config_ext)
base_env.unwrapped.configure(config=config_ext)

# create an extended environment, with the width set on initialization
extended_env = self._make_env(config=config_ext)

# check consistency parameters in config
for par in base_env.config["params"]:
base_val = base_env.config["params"][par]
extended_val = extended_env.config["params"][par]
for par in base_env.unwrapped.config["params"]:
base_val = base_env.unwrapped.config["params"][par]
extended_val = extended_env.unwrapped.config["params"][par]

self.assertEqual(base_val, extended_val, f"{par} should be the same")

Expand Down Expand Up @@ -104,7 +104,7 @@ def test_configure_action_space(self):
new_v_max = 5.0
params["v_max"] = new_v_max

base_env.configure(config={"params": params})
base_env.unwrapped.configure(config={"params": params})
new_action_space_low = base_env.action_space.low
new_action_space_high = base_env.action_space.high

Expand Down Expand Up @@ -156,7 +156,7 @@ def test_manual_reset_options_in_synch_vec_env(self):
"num_agents": num_agents,
"observation_config": {"type": "kinematic_state"},
}
vec_env = gym.vector.make(
vec_env = gym.make_vec(
"f1tenth_gym:f1tenth-v0", asynchronous=False, config=config, num_envs=num_envs
)

Expand Down

0 comments on commit e5d8198

Please sign in to comment.