Skip to content

Commit

Permalink
reduce costs from 0.5 to 1 m/s
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Jan 4, 2022
1 parent 9ebf354 commit f0550a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ def set_weights_for_lead_policy(self):
x_ego_obstacle_cost_multiplier = 1 # interp(self.desired_TR, TRs, [3., 1.0, 0.1])
j_ego_cost_multiplier = 1 # interp(self.desired_TR, TRs, [0.5, 1.0, 1.0])
d_zone_cost_multiplier = 1 # interp(self.desired_TR, TRs, [4., 1.0, 1.0])
_J_EGO_COST = J_EGO_COST * interp(self.v_ego, [0.5, 1.0], [0.1, 1.0])
_A_CHANGE_COST = A_CHANGE_COST * interp(self.v_ego, [0.5, 1.0], [0.1, 1.0])

W = np.asfortranarray(np.diag([X_EGO_OBSTACLE_COST * x_ego_obstacle_cost_multiplier, X_EGO_COST, V_EGO_COST, A_EGO_COST, A_CHANGE_COST, J_EGO_COST * j_ego_cost_multiplier]))
W = np.asfortranarray(np.diag([X_EGO_OBSTACLE_COST * x_ego_obstacle_cost_multiplier, X_EGO_COST, V_EGO_COST, A_EGO_COST, _A_CHANGE_COST, _J_EGO_COST]))
for i in range(N):
W[4,4] = A_CHANGE_COST * np.interp(T_IDXS[i], [0.0, 1.0, 2.0], [1.0, 1.0, 0.0])
self.solver.cost_set(i, 'W', W)
Expand Down

0 comments on commit f0550a7

Please sign in to comment.