From 9b84ec08148ffb892415eccd54c0b81c08ab35a2 Mon Sep 17 00:00:00 2001 From: cfranhonda <46506059+cfranhonda@users.noreply.github.com> Date: Thu, 7 Jan 2021 21:53:03 -0800 Subject: [PATCH] #2 --- selfdrive/controls/lib/long_mpc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selfdrive/controls/lib/long_mpc.py b/selfdrive/controls/lib/long_mpc.py index f9bf15cc048067..4d87bb7908523a 100644 --- a/selfdrive/controls/lib/long_mpc.py +++ b/selfdrive/controls/lib/long_mpc.py @@ -91,7 +91,10 @@ def update(self, pm, CS, lead): # Calculate mpc t = sec_since_boot() - n_its = self.libmpc.run_mpc(self.cur_state, self.mpc_solution, self.a_lead_tau, a_lead) + TR = 1.8 # todo: your custom logic to decide TR in seconds here + # cost = 0.1 # todo: from MPC_COST_LONG.DISTANCE, this needs to change with distance + # self.libmpc.change_tr(MPC_COST_LONG.TTC, cost, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK) # todo: so update with this line every time you change TR + n_its = self.libmpc.run_mpc(self.cur_state, self.mpc_solution, self.a_lead_tau, a_lead, TR) duration = int((sec_since_boot() - t) * 1e9) if LOG_MPC: