@ -60,7 +60,7 @@ mat3 update_calibration(Eigen::Vector3d device_from_calib_euler, bool wide_camer
void run_model ( ModelState & model , VisionIpcClient & vipc_client_main , VisionIpcClient & vipc_client_extra , bool main_wide_camera , bool use_extra_client ) {
// messaging
PubMaster pm ( { " modelV2 " , " cameraOdometry " } ) ;
SubMaster sm ( { " lateralPlan " , " roadCameraState " , " liveCalibration " , " driverMonitoringState " , " mapRenderState " , " navInstruction " , " navModel " } ) ;
SubMaster sm ( { " lateralPlan " , " roadCameraState " , " liveCalibration " , " driverMonitoringState " , " navModel " } ) ;
// setup filter to track dropped frames
FirstOrderFilter frame_dropped_filter ( 0. , 10. , 1. / MODEL_FREQ ) ;
@ -138,10 +138,8 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
}
// Enable/disable nav features
double tsm = ( float ) ( nanos_since_boot ( ) - sm [ " mapRenderState " ] . getMapRenderState ( ) . getLocationMonoTime ( ) ) / 1e6 ;
bool route_valid = sm [ " navInstruction " ] . getValid ( ) & & ( tsm < 1000 ) ;
bool render_valid = sm [ " mapRenderState " ] . getValid ( ) & & ( sm [ " navModel " ] . getNavModel ( ) . getFrameId ( ) = = sm [ " mapRenderState " ] . getMapRenderState ( ) . getFrameId ( ) ) ;
bool nav_valid = route_valid & & render_valid ;
uint64_t timestamp_llk = sm [ " navModel " ] . getNavModel ( ) . getLocationMonoTime ( ) ;
bool nav_valid = sm [ " navModel " ] . getValid ( ) & & ( nanos_since_boot ( ) - timestamp_llk < 1e9 ) ;
if ( ! nav_enabled & & nav_valid ) {
nav_enabled = true ;
} else if ( nav_enabled & & ! nav_valid ) {
@ -178,7 +176,7 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
float model_execution_time = ( mt2 - mt1 ) / 1000.0 ;
if ( model_output ! = nullptr ) {
model_publish ( & model , pm , meta_main . frame_id , meta_extra . frame_id , frame_id , frame_drop_ratio , * model_output , meta_main . timestamp_eof , model_execution_time ,
model_publish ( & model , pm , meta_main . frame_id , meta_extra . frame_id , frame_id , frame_drop_ratio , * model_output , meta_main . timestamp_eof , timestamp_llk , model_execution_time ,
nav_enabled , live_calib_seen ) ;
posenet_publish ( pm , meta_main . frame_id , vipc_dropped_frames , * model_output , meta_main . timestamp_eof , live_calib_seen ) ;
}