diff --git a/f1tenth_gym/envs/track/track.py b/f1tenth_gym/envs/track/track.py index 52d17b7a..d698919f 100644 --- a/f1tenth_gym/envs/track/track.py +++ b/f1tenth_gym/envs/track/track.py @@ -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. @@ -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