@ -41,13 +41,30 @@ def fill_xyvat(builder, t, x, y, v, a, x_std=None, y_std=None, v_std=None, a_std 
			
		
	
		
			
				
					  if  a_std  is  not  None :   
			
		
	
		
			
				
					    builder . aStd  =  a_std . tolist ( )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					def  fill_model_msg ( msg :  capnp . _DynamicStructBuilder ,  net_output_data :  dict [ str ,  np . ndarray ] ,  publish_state :  PublishState ,  
			
		
	
		
			
				
					def  fill_xyz_poly ( builder ,  degree ,  x ,  y ,  z ) :  
			
		
	
		
			
				
					  xyz  =  np . stack ( [ x ,  y ,  z ] ,  axis = 1 )   
			
		
	
		
			
				
					  coeffs  =  np . polynomial . polynomial . polyfit ( ModelConstants . T_IDXS ,  xyz ,  deg = degree )   
			
		
	
		
			
				
					  builder . xCoefficients  =  coeffs [ : ,  0 ] . tolist ( )   
			
		
	
		
			
				
					  builder . yCoefficients  =  coeffs [ : ,  1 ] . tolist ( )   
			
		
	
		
			
				
					  builder . zCoefficients  =  coeffs [ : ,  2 ] . tolist ( )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					def  fill_model_msg ( base_msg :  capnp . _DynamicStructBuilder ,  extended_msg :  capnp . _DynamicStructBuilder ,  
			
		
	
		
			
				
					                   net_output_data :  dict [ str ,  np . ndarray ] ,  publish_state :  PublishState ,   
			
		
	
		
			
				
					                   vipc_frame_id :  int ,  vipc_frame_id_extra :  int ,  frame_id :  int ,  frame_drop :  float ,   
			
		
	
		
			
				
					                   timestamp_eof :  int ,  model_execution_time :  float ,  valid :  bool )  - >  None :   
			
		
	
		
			
				
					  frame_age  =  frame_id  -  vipc_frame_id  if  frame_id  >  vipc_frame_id  else  0   
			
		
	
		
			
				
					  msg . valid  =  valid   
			
		
	
		
			
				
					  extended_msg . valid  =  valid   
			
		
	
		
			
				
					  base_msg . valid  =  valid   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  modelV2  =  msg . modelV2   
			
		
	
		
			
				
					  driving_model_data  =  base_msg . drivingModelData   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  driving_model_data . frameId  =  vipc_frame_id   
			
		
	
		
			
				
					  driving_model_data . frameIdExtra  =  vipc_frame_id_extra   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  action  =  driving_model_data . action   
			
		
	
		
			
				
					  action . desiredCurvature  =  float ( net_output_data [ ' desired_curvature ' ] [ 0 , 0 ] )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  modelV2  =  extended_msg . modelV2   
			
		
	
		
			
				
					  modelV2 . frameId  =  vipc_frame_id   
			
		
	
		
			
				
					  modelV2 . frameIdExtra  =  vipc_frame_id_extra   
			
		
	
		
			
				
					  modelV2 . frameAge  =  frame_age   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -67,6 +84,10 @@ def fill_model_msg(msg: capnp._DynamicStructBuilder, net_output_data: dict[str, 
			
		
	
		
			
				
					  orientation_rate  =  modelV2 . orientationRate   
			
		
	
		
			
				
					  fill_xyzt ( orientation_rate ,  ModelConstants . T_IDXS ,  * net_output_data [ ' plan ' ] [ 0 , : , Plan . ORIENTATION_RATE ] . T )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # poly path   
			
		
	
		
			
				
					  poly_path  =  driving_model_data . path   
			
		
	
		
			
				
					  fill_xyz_poly ( poly_path ,  ModelConstants . POLY_PATH_DEGREE ,  * net_output_data [ ' plan ' ] [ 0 , : , Plan . POSITION ] . T )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # lateral planning   
			
		
	
		
			
				
					  action  =  modelV2 . action   
			
		
	
		
			
				
					  action . desiredCurvature  =  float ( net_output_data [ ' desired_curvature ' ] [ 0 , 0 ] )   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -98,6 +119,12 @@ def fill_model_msg(msg: capnp._DynamicStructBuilder, net_output_data: dict[str, 
			
		
	
		
			
				
					  modelV2 . laneLineStds  =  net_output_data [ ' lane_lines_stds ' ] [ 0 , : , 0 , 0 ] . tolist ( )   
			
		
	
		
			
				
					  modelV2 . laneLineProbs  =  net_output_data [ ' lane_lines_prob ' ] [ 0 , 1 : : 2 ] . tolist ( )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  lane_line_meta  =  driving_model_data . laneLineMeta   
			
		
	
		
			
				
					  lane_line_meta . leftY  =  modelV2 . laneLines [ 1 ] . y [ 0 ]   
			
		
	
		
			
				
					  lane_line_meta . leftProb  =  modelV2 . laneLineProbs [ 1 ]   
			
		
	
		
			
				
					  lane_line_meta . rightY  =  modelV2 . laneLines [ 2 ] . y [ 0 ]   
			
		
	
		
			
				
					  lane_line_meta . rightProb  =  modelV2 . laneLineProbs [ 2 ]   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # road edges   
			
		
	
		
			
				
					  modelV2 . init ( ' roadEdges ' ,  2 )   
			
		
	
		
			
				
					  for  i  in  range ( 2 ) :