| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -82,8 +82,9 @@ void Localizer::build_live_location(cereal::LiveLocationKalman::Builder& fix) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  //fix_pos_geo_std = np.abs(coord.ecef2geodetic(fix_ecef + fix_ecef_std) - fix_pos_geo)
 | 
					 | 
					 | 
					 | 
					  //fix_pos_geo_std = np.abs(coord.ecef2geodetic(fix_ecef + fix_ecef_std) - fix_pos_geo)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd orientation_ecef = quat2euler(vector2quat(predicted_state.segment<STATE_ECEF_ORIENTATION_LEN>(STATE_ECEF_ORIENTATION_START))); | 
					 | 
					 | 
					 | 
					  VectorXd orientation_ecef = quat2euler(vector2quat(predicted_state.segment<STATE_ECEF_ORIENTATION_LEN>(STATE_ECEF_ORIENTATION_START))); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd orientation_ecef_std = predicted_std.segment<STATE_ECEF_ORIENTATION_ERR_LEN>(STATE_ECEF_ORIENTATION_ERR_START); | 
					 | 
					 | 
					 | 
					  VectorXd orientation_ecef_std = predicted_std.segment<STATE_ECEF_ORIENTATION_ERR_LEN>(STATE_ECEF_ORIENTATION_ERR_START); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  MatrixXdr device_from_ecef = quat2rot(vector2quat(predicted_state.segment<STATE_ECEF_ORIENTATION_LEN>(STATE_ECEF_ORIENTATION_START))).transpose(); | 
					 | 
					 | 
					 | 
					  MatrixXdr device_from_ecef = euler2rot(orientation_ecef).transpose(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd calibrated_orientation_ecef = rot2euler(this->calib_from_device * device_from_ecef); | 
					 | 
					 | 
					 | 
					  //VectorXd calibrated_orientation_ecef = rot2euler(device_from_ecef);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  VectorXd calibrated_orientation_ecef = rot2euler((this->calib_from_device * device_from_ecef).transpose()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd acc_calib = this->calib_from_device * predicted_state.segment<STATE_ACCELERATION_LEN>(STATE_ACCELERATION_START); | 
					 | 
					 | 
					 | 
					  VectorXd acc_calib = this->calib_from_device * predicted_state.segment<STATE_ACCELERATION_LEN>(STATE_ACCELERATION_START); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  MatrixXdr acc_calib_cov = predicted_cov.block<STATE_ACCELERATION_ERR_LEN, STATE_ACCELERATION_ERR_LEN>(STATE_ACCELERATION_ERR_START, STATE_ACCELERATION_ERR_START); | 
					 | 
					 | 
					 | 
					  MatrixXdr acc_calib_cov = predicted_cov.block<STATE_ACCELERATION_ERR_LEN, STATE_ACCELERATION_ERR_LEN>(STATE_ACCELERATION_ERR_START, STATE_ACCELERATION_ERR_START); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -115,6 +116,7 @@ void Localizer::build_live_location(cereal::LiveLocationKalman::Builder& fix) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd orientation_ned = ned_euler_from_ecef(fix_ecef_ecef, orientation_ecef); | 
					 | 
					 | 
					 | 
					  VectorXd orientation_ned = ned_euler_from_ecef(fix_ecef_ecef, orientation_ecef); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  //orientation_ned_std = ned_euler_from_ecef(fix_ecef, orientation_ecef + orientation_ecef_std) - orientation_ned
 | 
					 | 
					 | 
					 | 
					  //orientation_ned_std = ned_euler_from_ecef(fix_ecef, orientation_ecef + orientation_ecef_std) - orientation_ned
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  VectorXd calibrated_orientation_ned = ned_euler_from_ecef(fix_ecef_ecef, calibrated_orientation_ecef); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd nextfix_ecef = fix_ecef + vel_ecef; | 
					 | 
					 | 
					 | 
					  VectorXd nextfix_ecef = fix_ecef + vel_ecef; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VectorXd ned_vel = this->converter->ecef2ned((ECEF) { .x = nextfix_ecef(0), .y = nextfix_ecef(1), .z = nextfix_ecef(2) }).to_vector() - converter->ecef2ned(fix_ecef_ecef).to_vector(); | 
					 | 
					 | 
					 | 
					  VectorXd ned_vel = this->converter->ecef2ned((ECEF) { .x = nextfix_ecef(0), .y = nextfix_ecef(1), .z = nextfix_ecef(2) }).to_vector() - converter->ecef2ned(fix_ecef_ecef).to_vector(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  //ned_vel_std = self.converter->ecef2ned(fix_ecef + vel_ecef + vel_ecef_std) - self.converter->ecef2ned(fix_ecef + vel_ecef)
 | 
					 | 
					 | 
					 | 
					  //ned_vel_std = self.converter->ecef2ned(fix_ecef + vel_ecef + vel_ecef_std) - self.converter->ecef2ned(fix_ecef + vel_ecef)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -137,6 +139,7 @@ void Localizer::build_live_location(cereal::LiveLocationKalman::Builder& fix) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  init_measurement(fix.initOrientationECEF(), orientation_ecef, orientation_ecef_std, true); | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initOrientationECEF(), orientation_ecef, orientation_ecef_std, true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  init_measurement(fix.initCalibratedOrientationECEF(), calibrated_orientation_ecef, nans, this->calibrated); | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initCalibratedOrientationECEF(), calibrated_orientation_ecef, nans, this->calibrated); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  init_measurement(fix.initOrientationNED(), orientation_ned, nans, true); | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initOrientationNED(), orientation_ned, nans, true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initCalibratedOrientationNED(), calibrated_orientation_ned, nans, true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  init_measurement(fix.initAngularVelocityDevice(), angVelocityDevice, angVelocityDeviceErr, true); | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initAngularVelocityDevice(), angVelocityDevice, angVelocityDeviceErr, true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  init_measurement(fix.initVelocityCalibrated(), vel_calib, vel_calib_std, this->calibrated); | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initVelocityCalibrated(), vel_calib, vel_calib_std, this->calibrated); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  init_measurement(fix.initAngularVelocityCalibrated(), ang_vel_calib, ang_vel_calib_std, this->calibrated); | 
					 | 
					 | 
					 | 
					  init_measurement(fix.initAngularVelocityCalibrated(), ang_vel_calib, ang_vel_calib_std, this->calibrated); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |