Skip to content

frenet_converter

FrenetConverter

__init__(waypoints_x, waypoints_y)

Initializes the FrenetConverter object with the given waypoints.

build_raceline()

Builds the spline representation of the raceline.

check_perpendicular(x, y, s, eps_m=0.01)

Checks if the point is perpendicular to the track.

get_approx_s(x, y)

Finds the s-coordinate of the given point by finding the nearest waypoint.

get_cartesian(s, d)

Convert Frenet coordinates to Cartesian coordinates

Parameters:

Name Type Description Default
s float

longitudinal coordinate

required
d float

lateral coordinate

required

Returns:

Type Description
array

np.array: [x, y] Cartesian coordinates

get_derivative(s)

Returns the derivative of the point corresponding to s on the chosen line.

Parameters:

Name Type Description Default
s

parameter which is used to evaluate the spline

required
line

argument used to choose the line. Can be 'int', 'mid', 'out'. Default is 'mid'.

required

Returns:

Name Type Description
der array

dx/ds, dy/ds

get_frenet(x, y, s=None)

Converts Cartesian coordinates to Frenet coordinates.

get_frenet_coord(x, y, s, eps_m=0.01)

Finds the s-coordinate of the given point, considering the perpendicular projection of the point on the track.

Parameters:

Name Type Description Default
x float

x-coordinate of the point

required
y float

y-coordinate of the point

required
s float

estimated s-coordinate of the point

required
eps_m float

maximum error tolerance for the projection. Default is 0.01.

0.01

Returns:

Type Description
float

The s-coordinate of the point on the track.