Skip to content

Commit 08401a9

Browse files
authored
modeld: frame delay (#37731)
* Frame delay * Multiply * If replay * For long too * DT_MDL / 2 * Shorten comment * Just 50ms * Remove REPLAY const
1 parent f37fd3e commit 08401a9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

selfdrive/modeld/modeld.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ def main(demo=False):
405405
drivingdata_send = messaging.new_message('drivingModelData')
406406
posenet_send = messaging.new_message('cameraOdometry')
407407

408-
action = get_action_from_model(model_output, prev_action, lat_delay + DT_MDL, long_delay + DT_MDL, v_ego)
408+
frame_delay = DT_MDL # compensate for time passed since the frame was captured: current_time - timestamp_eof is 50ms on average
409+
action_delay = DT_MDL / 2 # middle of the interval between model output (current state) and next frame (expected state)
410+
action = get_action_from_model(model_output, prev_action, lat_delay + frame_delay + action_delay, long_delay + frame_delay + action_delay, v_ego)
409411
prev_action = action
410412
fill_model_msg(drivingdata_send, modelv2_send, model_output, action,
411413
publish_state, meta_main.frame_id, meta_extra.frame_id, frame_id,

0 commit comments

Comments
 (0)