Skip to content

Commit

Permalink
Add scaling to track from dir
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmadAmine998 committed Oct 9, 2024
1 parent 4d706e6 commit 953e70b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion f1tenth_gym/envs/track/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def from_track_name(track: str, track_scale: float = 1.0) -> Track:
raise FileNotFoundError(f"It could not load track {track}") from ex

@staticmethod
def from_track_path(path: pathlib.Path):
def from_track_path(path: pathlib.Path, track_scale: float = 1.0) -> Track:
"""
Load track from track path.
Expand All @@ -191,6 +191,12 @@ def from_track_path(path: pathlib.Path):
track_spec = Track.load_spec(
track=path.stem, filespec=path
)
track_spec.resolution = track_spec.resolution * track_scale
track_spec.origin = (
track_spec.origin[0] * track_scale,
track_spec.origin[1] * track_scale,
track_spec.origin[2],
)

# load occupancy grid
# Image path is from path + image name from track_spec
Expand Down

0 comments on commit 953e70b

Please sign in to comment.