Skip to content

Commit

Permalink
defined array of x, y, yaw, curvature and speed
Browse files Browse the repository at this point in the history
  • Loading branch information
ShisatoYano committed Dec 10, 2024
1 parent 01c700e commit 6ccde1c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/components/course/cubic_spline_course/cubic_spline_course.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ def __init__(self, x_ref_points, y_ref_points, target_speed_kmph, resolution=0.1
cubic_spline = CubicSpline2D(x_ref_points, y_ref_points)
base_points = np.arange(0, cubic_spline.s[-1], resolution)

self.x_array, self.y_array = [], []
self.yaw_array, self.curvature_array = [], []
for base_point in base_points:
x, y = cubic_spline.calc_interpolated_xy(base_point)
self.x_array.append(x)
self.y_array.append(y)
self.yaw_array.append(cubic_spline.calc_yaw_angle(base_point))
self.curvature_array.append(cubic_spline.calc_curvature(base_point))

self.speed_array = [(target_speed_kmph / 3.6) for _ in self.x_array]
self.speed_array[-1] = 0.0

self.color = color


csc = CubicSplineCourse([0.0, 10.0, 25, 40, 50], [0.0, 4, -12, 20, -13], 10)

0 comments on commit 6ccde1c

Please sign in to comment.