|  |  |  | @ -255,9 +255,6 @@ class LongitudinalMpc: | 
			
		
	
		
			
				
					|  |  |  |  |     elif self.mode == 'blended': | 
			
		
	
		
			
				
					|  |  |  |  |       cost_weights = [0., 0.2, 0.25, 1.0, 0.0, 1.0] | 
			
		
	
		
			
				
					|  |  |  |  |       constraint_cost_weights = [LIMIT_COST, LIMIT_COST, LIMIT_COST, 50.0] | 
			
		
	
		
			
				
					|  |  |  |  |     elif self.mode == 'e2e': | 
			
		
	
		
			
				
					|  |  |  |  |       cost_weights = [0., 0.2, 0.25, 1., 0.0, .1] | 
			
		
	
		
			
				
					|  |  |  |  |       constraint_cost_weights = [LIMIT_COST, LIMIT_COST, LIMIT_COST, 0.0] | 
			
		
	
		
			
				
					|  |  |  |  |     else: | 
			
		
	
		
			
				
					|  |  |  |  |       raise NotImplementedError(f'Planner mode {self.mode} not recognized in planner cost set') | 
			
		
	
		
			
				
					|  |  |  |  |     self.set_cost_weights(cost_weights, constraint_cost_weights) | 
			
		
	
	
		
			
				
					|  |  |  | @ -386,28 +383,6 @@ class LongitudinalMpc: | 
			
		
	
		
			
				
					|  |  |  |  |          (lead_1_obstacle[0] - lead_0_obstacle[0]): | 
			
		
	
		
			
				
					|  |  |  |  |         self.source = 'lead1' | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   def update_with_xva(self, x, v, a): | 
			
		
	
		
			
				
					|  |  |  |  |     self.params[:,0] = -10. | 
			
		
	
		
			
				
					|  |  |  |  |     self.params[:,1] = 10. | 
			
		
	
		
			
				
					|  |  |  |  |     self.params[:,2] = 1e5 | 
			
		
	
		
			
				
					|  |  |  |  |     self.params[:,4] = T_FOLLOW | 
			
		
	
		
			
				
					|  |  |  |  |     self.params[:,5] = LEAD_DANGER_FACTOR | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     # v, and a are in local frame, but x is wrt the x[0] position | 
			
		
	
		
			
				
					|  |  |  |  |     # In >90degree turns, x goes to 0 (and may even be -ve) | 
			
		
	
		
			
				
					|  |  |  |  |     # So, we use integral(v) + x[0] to obtain the forward-distance | 
			
		
	
		
			
				
					|  |  |  |  |     xforward = ((v[1:] + v[:-1]) / 2) * (T_IDXS[1:] - T_IDXS[:-1]) | 
			
		
	
		
			
				
					|  |  |  |  |     x = np.cumsum(np.insert(xforward, 0, x[0])) | 
			
		
	
		
			
				
					|  |  |  |  |     self.yref[:,1] = x | 
			
		
	
		
			
				
					|  |  |  |  |     self.yref[:,2] = v | 
			
		
	
		
			
				
					|  |  |  |  |     self.yref[:,3] = a | 
			
		
	
		
			
				
					|  |  |  |  |     for i in range(N): | 
			
		
	
		
			
				
					|  |  |  |  |       self.solver.cost_set(i, "yref", self.yref[i]) | 
			
		
	
		
			
				
					|  |  |  |  |     self.solver.cost_set(N, "yref", self.yref[N][:COST_E_DIM]) | 
			
		
	
		
			
				
					|  |  |  |  |     self.params[:,3] = np.copy(self.prev_a) | 
			
		
	
		
			
				
					|  |  |  |  |     self.run() | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   def run(self): | 
			
		
	
		
			
				
					|  |  |  |  |     # t0 = sec_since_boot() | 
			
		
	
		
			
				
					|  |  |  |  |     # reset = 0 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |