Skip to content

Commit

Permalink
example: close env in video recording to save trigger saving video.
Browse files Browse the repository at this point in the history
f110 env: set render-fps to match integrator timestep to match real time in human/rgb-array render mode.
refactoring config files renderer
  • Loading branch information
luigiberducci committed Nov 24, 2023
1 parent 28a9c2b commit 7392f7e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 4 additions & 1 deletion examples/video_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main():
"lf": 0.15597534362552312,
"tlad": 0.82461887897713965,
"vgain": 1,
} # 0.90338203837889}
}

env = gym.make(
"f110_gym:f110-v0",
Expand Down Expand Up @@ -69,6 +69,9 @@ def main():

print("Sim elapsed time:", laptime, "Real elapsed time:", time.time() - start)

# close env to trigger video saving
env.close()


if __name__ == "__main__":
main()
3 changes: 3 additions & 0 deletions gym/f110_gym/envs/f110_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def __init__(self, config: dict = None, render_mode=None, **kwargs):
# add choice of colors (same, random, ...)
self.render_obs = None
self.render_mode = render_mode

# match render_fps to integration timestep
self.metadata["render_fps"] = int(1.0 / self.timestep)
if self.render_mode == "human_fast":
self.metadata["render_fps"] *= 10 # boost fps by 10x
self.renderer, self.render_spec = make_renderer(
Expand Down
4 changes: 2 additions & 2 deletions gym/f110_gym/envs/rendering/rendering.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
window_size: 1000 # [px] width and height of the window
focus_on: null # [str] agent id to focus on (e.g., agent_0) or null for map view
window_size: 800 # [px] width and height of the window
focus_on: agent_0 # [str] agent id to focus on (e.g., agent_0) or null for map view
zoom_in_factor: 1.5 # [float] zoom in factor. 1.0 is no zoom, >1.0 is zoom in, <1.0 is zoom out
show_wheels: True # [bool] it toggles the visualization of the vehicle wheels
car_tickness: 1 # [px] thickness of the car
Expand Down
8 changes: 0 additions & 8 deletions gym/f110_gym/envs/rendering/rendering_fast.yaml

This file was deleted.

0 comments on commit 7392f7e

Please sign in to comment.