From 953e70b4d7b6e321d9b023259fe5da2ceb15b57c Mon Sep 17 00:00:00 2001 From: Ahmad Amine Date: Wed, 9 Oct 2024 01:43:28 -0400 Subject: [PATCH] Add scaling to track from dir --- f1tenth_gym/envs/track/track.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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