Skip to content

Commit

Permalink
type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
Berducci, Luigi committed Jun 14, 2024
1 parent 23ae07c commit a31f52c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions f1tenth_gym/envs/track/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

@dataclass
class TrackSpec(YamlDataClassConfig):
name: str
image: str
name: Optional[str]
image: Optional[str]
resolution: float
origin: Tuple[float, float, float]
negate: int
Expand All @@ -28,18 +28,18 @@ class TrackSpec(YamlDataClassConfig):
@dataclass
class Track:
spec: TrackSpec
filepath: str
ext: str
filepath: Optional[str]
ext: Optional[str]
occupancy_map: np.ndarray
centerline: Raceline
raceline: Raceline

def __init__(
self,
spec: TrackSpec,
filepath: str,
ext: str,
occupancy_map: np.ndarray,
filepath: Optional[str] = None,
ext: Optional[str] = None,
centerline: Optional[Raceline] = None,
raceline: Optional[Raceline] = None,
):
Expand Down Expand Up @@ -154,7 +154,7 @@ def from_track_name(track: str):
raise FileNotFoundError(f"It could not load track {track}") from ex

@staticmethod
def from_refline(x: np.ndarray, y: np.ndarray, velx: np.ndarray,):
def from_refline(x: np.ndarray, y: np.ndarray, velx: np.ndarray):
"""
Create an empty track reference line.
Expand All @@ -169,7 +169,7 @@ def from_refline(x: np.ndarray, y: np.ndarray, velx: np.ndarray,):
Returns
-------
Track
track: Track
track object
"""
ds = 0.1
Expand Down Expand Up @@ -241,7 +241,7 @@ def from_refline(x: np.ndarray, y: np.ndarray, velx: np.ndarray,):
def frenet_to_cartesian(self, s, ey, ephi):
"""
Convert Frenet coordinates to Cartesian coordinates.
s: distance along the raceline
ey: lateral deviation
ephi: heading deviation
Expand All @@ -262,11 +262,11 @@ def frenet_to_cartesian(self, s, ey, ephi):
psi += ephi

return x, y, psi

def cartesian_to_frenet(self, x, y, phi, s_guess=0):
"""
Convert Cartesian coordinates to Frenet coordinates.
x: x-coordinate
y: y-coordinate
phi: yaw angle
Expand Down

0 comments on commit a31f52c

Please sign in to comment.