From d6f60e08c1749197077eff28d7c1f806427d7602 Mon Sep 17 00:00:00 2001 From: Ahmad Amine Date: Fri, 7 Jun 2024 03:29:06 -0400 Subject: [PATCH] Add unions to calc yaw and calc curvature --- f1tenth_gym/envs/track/cubic_spline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/f1tenth_gym/envs/track/cubic_spline.py b/f1tenth_gym/envs/track/cubic_spline.py index c14e41c9..fd61e644 100644 --- a/f1tenth_gym/envs/track/cubic_spline.py +++ b/f1tenth_gym/envs/track/cubic_spline.py @@ -114,7 +114,7 @@ def calc_position(self, s: float) -> tuple[Union[float, None], Union[float, None """ return self.spline(s) - def calc_curvature(self, s: float) -> float | None: + def calc_curvature(self, s: float) -> Union[float , None]: """ Calc curvature at the given s. @@ -134,7 +134,7 @@ def calc_curvature(self, s: float) -> float | None: k = (ddy * dx - ddx * dy) / ((dx**2 + dy**2) ** (3 / 2)) return k - def calc_yaw(self, s: float) -> float | None: + def calc_yaw(self, s: float) -> Union[float, None]: """ Calc yaw angle at the given s.