Skip to content

Commit

Permalink
Merge pull request #87 from ll7/85-Read-video-fps-from-env-config
Browse files Browse the repository at this point in the history
Read video fps from env config
  • Loading branch information
ll7 authored Dec 6, 2024
2 parents e067103 + 02be785 commit 576c3f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion robot_sf/gym_env/robot_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
recording_enabled: bool = False,
record_video: bool = False,
video_path: str = None,
video_fps: int = 10, # TODO: Read from env settings
video_fps: float = None,
peds_have_obstacle_forces: bool = False,
):
"""
Expand All @@ -76,6 +76,11 @@ def __init__(
# Environment configuration details
self.env_config = env_config

# Set video FPS if not provided
if video_fps is None:
video_fps = 1/self.env_config.sim_config.time_per_step_in_secs
logger.info(f"Video FPS not provided, setting to {video_fps}")

# Extract first map definition; currently only supports using the first map
self.map_def = env_config.map_pool.choose_random_map()

Expand Down
2 changes: 1 addition & 1 deletion robot_sf/render/sim_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class SimulationView:
focus_on_ego_ped: bool = False
record_video: bool = False
video_path: str = None
video_fps: int = 10
video_fps: float = 10.0
frames: List[np.ndarray] = field(default_factory=list)

# Add UI state fields
Expand Down
3 changes: 1 addition & 2 deletions tests/test_video_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def test_video_recording(
debug=True,
recording_enabled=True,
record_video=True,
video_path=str(video_path),
video_fps=int(1 / env_config.sim_config.time_per_step_in_secs),
video_path=str(video_path)
)

try:
Expand Down

0 comments on commit 576c3f0

Please sign in to comment.