paramsd process replay test (#2118)

* paramsd process replay test

* cleanup
pull/2124/head
Adeeb Shihadeh 2020-09-01 18:31:26 -07:00 committed by GitHub
parent 21fbe26980
commit 1e5a935ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 14 deletions

View File

@ -19,6 +19,9 @@ from common.params import Params
from cereal.services import service_list
from collections import namedtuple
# Numpy gives different results based on CPU features after version 19
NUMPY_TOLERANCE = 1e-7
ProcessConfig = namedtuple('ProcessConfig', ['proc_name', 'pub_sub', 'ignore', 'init_callback', 'should_recv_callback', 'tolerance'])
@ -197,14 +200,16 @@ def radar_rcv_callback(msg, CP, cfg, fsm):
def calibration_rcv_callback(msg, CP, cfg, fsm):
# calibrationd publishes 1 calibrationData every 5 cameraOdometry packets.
# should_recv always true to increment frame
if msg.which() == 'carState':
if ((fsm.frame + 1) % 25) == 0:
recv_socks = ["liveCalibration"]
else:
recv_socks = []
return recv_socks, True
else:
return [], False
recv_socks = []
if msg.which() == 'carState' and ((fsm.frame + 1) % 25) == 0:
recv_socks = ["liveCalibration"]
return recv_socks, msg.which() == 'carState'
def paramsd_rcv_callback(msg, CP, cfg, fsm):
recv_socks = []
if msg.which() == 'carState' and ((fsm.frame + 2) % 5) == 0:
recv_socks = ["liveParameters"]
return recv_socks, msg.which() == 'carState'
CONFIGS = [
@ -262,7 +267,7 @@ CONFIGS = [
ignore=["logMonoTime", "valid"],
init_callback=get_car_params,
should_recv_callback=None,
tolerance=1e-7,
tolerance=NUMPY_TOLERANCE,
),
ProcessConfig(
proc_name="locationd",
@ -273,9 +278,19 @@ CONFIGS = [
ignore=["logMonoTime", "valid"],
init_callback=get_car_params,
should_recv_callback=None,
tolerance=1e-7, # Numpy gives different results based on CPU features after version 19
tolerance=NUMPY_TOLERANCE,
),
ProcessConfig(
proc_name="paramsd",
pub_sub={
"carState": ["liveParameters"],
"liveLocationKalman": []
},
ignore=["logMonoTime", "valid"],
init_callback=get_car_params,
should_recv_callback=paramsd_rcv_callback,
tolerance=NUMPY_TOLERANCE,
),
]
def replay_process(cfg, lr):

View File

@ -1 +1 @@
158743f002e82b62a67c6b91308db01d715f1643
eac7f0ebb37c2a8a0cf70d3d25d32ecd160d6cac

View File

@ -6,8 +6,7 @@ from typing import Any
from selfdrive.car.car_helpers import interface_names
from selfdrive.test.process_replay.compare_logs import compare_logs
from selfdrive.test.process_replay.process_replay import (CONFIGS,
replay_process)
from selfdrive.test.process_replay.process_replay import CONFIGS, replay_process
from tools.lib.logreader import LogReader
INJECT_MODEL = 0