@@ -245,7 +245,7 @@ void fill_longi(cereal::ModelData::LongitudinalData::Builder longi, const float
245
245
longi.setAccelerations (accel);
246
246
}
247
247
248
- void model_publish (PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
248
+ void model_publish (PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id, bool sm_alive_valid,
249
249
const ModelDataRaw &net_outputs, uint64_t timestamp_eof) {
250
250
// make msg
251
251
capnp::MallocMessageBuilder msg;
@@ -256,6 +256,9 @@ void model_publish(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
256
256
framed.setFrameId (vipc_frame_id);
257
257
framed.setTimestampEof (timestamp_eof);
258
258
259
+ //
260
+ framed.setFrameAge ((frame_id > vipc_frame_id) ? frame_id - vipc_frame_id : 0 );
261
+
259
262
auto lpath = framed.initPath ();
260
263
fill_path (lpath, net_outputs.path , false , 0 );
261
264
auto left_lane = framed.initLeftLane ();
@@ -290,13 +293,13 @@ void model_publish(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
290
293
291
294
auto meta = framed.initMeta ();
292
295
fill_meta (meta, net_outputs.meta );
293
- event.setValid (frame_id < vipc_frame_id + MAX_FRAME_AGE);
296
+ event.setValid (( frame_id < vipc_frame_id + MAX_FRAME_AGE) && sm_alive_valid );
294
297
295
298
pm.send (" model" , msg);
296
299
}
297
300
298
- void posenet_publish (PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
299
- const ModelDataRaw &net_outputs, uint64_t timestamp_eof) {
301
+ void posenet_publish (PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id, bool sm_alive_valid,
302
+ const ModelDataRaw &net_outputs, uint64_t timestamp_eof) {
300
303
capnp::MallocMessageBuilder msg;
301
304
cereal::Event::Builder event = msg.initRoot <cereal::Event>();
302
305
event.setLogMonoTime (nanos_since_boot ());
@@ -326,7 +329,7 @@ void posenet_publish(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
326
329
327
330
posenetd.setTimestampEof (timestamp_eof);
328
331
posenetd.setFrameId (vipc_frame_id);
329
- event.setValid (frame_id < vipc_frame_id + MAX_FRAME_AGE);
332
+ event.setValid (( frame_id < vipc_frame_id + MAX_FRAME_AGE) && sm_alive_valid );
330
333
331
334
pm.send (" cameraOdometry" , msg);
332
335
}
0 commit comments