Skip to content

Commit

Permalink
added raceline opt track saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Milburn committed Feb 20, 2025
1 parent c8bcde3 commit 493105d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions f1tenth_gym/envs/track/raceline.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,20 @@ def render_waypoints(self, e: EnvRenderer) -> None:
self.waypoint_render = e.render_closed_lines(points, color=(0, 128, 0), size=1)
else:
self.waypoint_render.updateItems(points)


def save_to_file(self, filepath: pathlib.Path, delimiter: str = ",") -> None:
"""
Save the raceline parameters to a CSV file.
Parameters
----------
filepath : pathlib.Path
Path to the output file.
delimiter : str, optional
Delimiter to use in the CSV file, by default ","
"""

data = np.column_stack((self.ss, self.xs, self.ys, self.yaws, self.ks, self.vxs, self.axs))
header = "s_m,x_m,y_m,psi_rad,kappa_radpm,vx_mps,ax_mps2"
np.savetxt(filepath, data, delimiter=delimiter, header=header, comments="")

0 comments on commit 493105d

Please sign in to comment.