11
11
12
12
13
13
class LateralPlanner :
14
- def __init__ (self , CP , use_lanelines = True , wide_camera = False ):
14
+ def __init__ (self , use_lanelines = True , wide_camera = False ):
15
15
self .use_lanelines = use_lanelines
16
16
self .LP = LanePlanner (wide_camera )
17
17
self .DH = DesireHelper ()
18
18
19
19
self .last_cloudlog_t = 0
20
- self .steer_rate_cost = CP .steerRateCost
21
20
self .solution_invalid_cnt = 0
22
21
23
22
self .path_xyz = np .zeros ((TRAJECTORY_SIZE , 3 ))
@@ -59,12 +58,12 @@ def update(self, sm):
59
58
# Calculate final driving path and set MPC costs
60
59
if self .use_lanelines :
61
60
d_path_xyz = self .LP .get_d_path (v_ego , self .t_idxs , self .path_xyz )
62
- self .lat_mpc .set_weights (MPC_COST_LAT .PATH , MPC_COST_LAT .HEADING , self . steer_rate_cost )
61
+ self .lat_mpc .set_weights (MPC_COST_LAT .PATH , MPC_COST_LAT .HEADING , MPC_COST_LAT . STEER_RATE )
63
62
else :
64
63
d_path_xyz = self .path_xyz
65
64
# Heading cost is useful at low speed, otherwise end of plan can be off-heading
66
65
heading_cost = interp (v_ego , [5.0 , 10.0 ], [MPC_COST_LAT .HEADING , 0.15 ])
67
- self .lat_mpc .set_weights (MPC_COST_LAT .PATH , heading_cost , self . steer_rate_cost )
66
+ self .lat_mpc .set_weights (MPC_COST_LAT .PATH , heading_cost , MPC_COST_LAT . STEER_RATE )
68
67
69
68
y_pts = np .interp (v_ego * self .t_idxs [:LAT_MPC_N + 1 ], np .linalg .norm (d_path_xyz , axis = 1 ), d_path_xyz [:, 1 ])
70
69
heading_pts = np .interp (v_ego * self .t_idxs [:LAT_MPC_N + 1 ], np .linalg .norm (self .path_xyz , axis = 1 ), self .plan_yaw )
@@ -79,7 +78,7 @@ def update(self, sm):
79
78
y_pts ,
80
79
heading_pts )
81
80
# init state for next
82
- # mpc.u_sol is the desired curvature rate given x0 curv state.
81
+ # mpc.u_sol is the desired curvature rate given x0 curv state.
83
82
# with x0[3] = measured_curvature, this would be the actual desired rate.
84
83
# instead, interpolate x_sol so that x0[3] is the desired curvature for lat_control.
85
84
self .x0 [3 ] = interp (DT_MDL , self .t_idxs [:LAT_MPC_N + 1 ], self .lat_mpc .x_sol [:, 3 ])
0 commit comments