Skip to content

Commit 90c5984

Browse files
authored
fix state_lattice_planner.py coordinate conversion (#495)
1 parent 7f382b6 commit 90c5984

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

PathPlanning/StateLatticePlanner/state_lattice_planner.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ def calc_lane_states(l_center, l_heading, l_width, v_width, d, nxy):
156156
:param nxy: sampling number
157157
:return: state list
158158
"""
159-
xc = math.cos(l_heading) * d + math.sin(l_heading) * l_center
160-
yc = math.sin(l_heading) * d + math.cos(l_heading) * l_center
159+
xc = d
160+
yc = l_center
161161

162162
states = []
163163
for i in range(nxy):
@@ -301,14 +301,17 @@ def lane_state_sampling_test1():
301301
k0 = 0.0
302302

303303
l_center = 10.0
304-
l_heading = np.deg2rad(90.0)
304+
l_heading = np.deg2rad(0.0)
305305
l_width = 3.0
306306
v_width = 1.0
307307
d = 10
308308
nxy = 5
309309
states = calc_lane_states(l_center, l_heading, l_width, v_width, d, nxy)
310310
result = generate_path(states, k0)
311311

312+
if show_animation:
313+
plt.close("all")
314+
312315
for table in result:
313316
xc, yc, yawc = motion_model.generate_trajectory(
314317
table[3], table[4], table[5], k0)

0 commit comments

Comments
 (0)