11"""
2+
23Lookup Table generation for model predictive trajectory generator
34
45author: Atsushi Sakai
6+
57"""
68from matplotlib import pyplot as plt
79import numpy as np
1416def calc_states_list ():
1517 maxyaw = np .deg2rad (- 30.0 )
1618
17- x = np .arange (1 .0 , 30.0 , 5.0 )
19+ x = np .arange (10 .0 , 30.0 , 5.0 )
1820 y = np .arange (0.0 , 20.0 , 2.0 )
1921 yaw = np .arange (- maxyaw , maxyaw , maxyaw )
2022
@@ -23,7 +25,7 @@ def calc_states_list():
2325 for iy in y :
2426 for ix in x :
2527 states .append ([ix , iy , iyaw ])
26- # print(len(states))
28+ print ("nstate:" , len (states ))
2729
2830 return states
2931
@@ -75,8 +77,8 @@ def generate_lookup_table():
7577 state [0 ], state [1 ], state [2 ], lookuptable )
7678
7779 target = motion_model .State (x = state [0 ], y = state [1 ], yaw = state [2 ])
78- init_p = np .matrix (
79- [math .sqrt (state [0 ] ** 2 + state [1 ] ** 2 ), bestp [4 ], bestp [5 ]]).T
80+ init_p = np .array (
81+ [math .sqrt (state [0 ] ** 2 + state [1 ] ** 2 ), bestp [4 ], bestp [5 ]]).reshape ( 3 , 1 )
8082
8183 x , y , yaw , p = planner .optimize_trajectory (target , k0 , init_p )
8284
0 commit comments