From 597b0f82f762a81d71b73d6b17d9ce7642a07865 Mon Sep 17 00:00:00 2001 From: Ahmad Amine Date: Fri, 7 Jun 2024 03:25:32 -0400 Subject: [PATCH] Use union for python3.8 compatibility --- f1tenth_gym/envs/track/cubic_spline.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/f1tenth_gym/envs/track/cubic_spline.py b/f1tenth_gym/envs/track/cubic_spline.py index 36fb3c08..c14e41c9 100644 --- a/f1tenth_gym/envs/track/cubic_spline.py +++ b/f1tenth_gym/envs/track/cubic_spline.py @@ -8,6 +8,7 @@ import scipy.optimize as so from scipy import interpolate from numba import njit +from typing import Union @njit(fastmath=False, cache=True) def nearest_point_on_trajectory(point, trajectory): @@ -94,7 +95,7 @@ def __calc_s(self, x: np.ndarray, y: np.ndarray) -> np.ndarray: s.extend(np.cumsum(self.ds)) return np.array(s) - def calc_position(self, s: float) -> tuple[float | None, float | None]: + def calc_position(self, s: float) -> tuple[Union[float, None], Union[float, None]]: """ Calc position at the given s.