Sensor events regen (#25903)

pull/25906/head
Kurt Nistelberger 3 years ago committed by GitHub
parent ba1c3cda41
commit 96ed5aa581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cereal
  2. 2
      selfdrive/test/process_replay/ref_commit
  3. 61
      selfdrive/test/process_replay/regen.py
  4. 30
      selfdrive/test/process_replay/test_processes.py

@ -1 +1 @@
Subproject commit a0c6f28d6bce2fd7d7ef2fd29e80d2eab118a6c6
Subproject commit e310f4860d349d2e260cfd4bb060b0705b17244c

@ -1 +1 @@
051fa5bea42027c1a756ae61fd0c752c1e911899
a82580edc3a842dd58814bf2fe1a0f0f85d438f5

@ -106,6 +106,23 @@ def replay_sensor_events(s, msgs):
rk.keep_time()
def replay_sensor_event(s, msgs):
smsgs = [m for m in msgs if m.which() == s]
#if len(smsgs) == 0:
# return
pm = messaging.PubMaster([s, ])
rk = Ratekeeper(service_list[s].frequency, print_delay_threshold=None)
while True:
for m in smsgs:
m = m.as_builder()
m.logMonoTime = int(sec_since_boot() * 1e9)
getattr(m, m.which()).timestamp = m.logMonoTime
pm.send(m.which(), m)
rk.keep_time()
def replay_service(s, msgs):
pm = messaging.PubMaster([s, ])
rk = Ratekeeper(service_list[s].frequency, print_delay_threshold=None)
@ -193,8 +210,49 @@ def migrate_carparams(lr):
return all_msgs
def migrate_sensorEvents(lr):
all_msgs = []
for msg in lr:
if msg.which() != 'sensorEvents':
all_msgs.append(msg)
continue
# migrate to split sensor events
for evt in msg.sensorEvents:
# build new message for each sensor type
sensor_service = ''
if evt.which() == 'acceleration':
sensor_service = 'accelerometer'
elif evt.which() == 'gyro' or evt.which() == 'gyroUncalibrated':
sensor_service = 'gyroscope'
elif evt.which() == 'light' or evt.which() == 'proximity':
sensor_service = 'lightSensor'
elif evt.which() == 'magnetic' or evt.which() == 'magneticUncalibrated':
sensor_service = 'magnetometer'
elif evt.which() == 'temperature':
sensor_service = 'temperatureSensor'
m = messaging.new_message(sensor_service)
m.valid = True
m_dat = getattr(m, sensor_service)
m_dat.version = evt.version
m_dat.sensor = evt.sensor
m_dat.type = evt.type
m_dat.source = evt.source
setattr(m_dat, evt.which(), getattr(evt, evt.which()))
all_msgs.append(m.as_reader())
# append also legacy sensorEvents, to have both (remove later)
all_msgs.append(msg)
return all_msgs
def regen_segment(lr, frs=None, outdir=FAKEDATA, disable_tqdm=False):
lr = migrate_carparams(list(lr))
lr = migrate_sensorEvents(list(lr))
if frs is None:
frs = dict()
@ -213,6 +271,9 @@ def regen_segment(lr, frs=None, outdir=FAKEDATA, disable_tqdm=False):
fake_daemons = {
'sensord': [
multiprocessing.Process(target=replay_sensor_events, args=('sensorEvents', lr)),
multiprocessing.Process(target=replay_sensor_event, args=('accelerometer', lr)),
multiprocessing.Process(target=replay_sensor_event, args=('gyroscope', lr)),
multiprocessing.Process(target=replay_sensor_event, args=('magnetometer', lr)),
],
'pandad': [
multiprocessing.Process(target=replay_service, args=('can', lr)),

@ -38,21 +38,21 @@ source_segments = [
]
segments = [
("BODY", "regen9D38397D30D|2022-09-09--13-12-48--0"),
("HYUNDAI", "regenB3953B393C0|2022-09-09--14-49-37--0"),
("HYUNDAI", "regen8DB830E5376|2022-09-13--17-24-37--0"),
("TOYOTA", "regen8FCBB6F06F1|2022-09-09--13-14-07--0"),
("TOYOTA2", "regen956BFA75300|2022-09-09--14-51-24--0"),
("TOYOTA3", "regenE909BC2F430|2022-09-09--20-44-49--0"),
("HONDA", "regenD1D10209015|2022-09-09--14-53-09--0"),
("HONDA2", "regen3F7C2EFDC08|2022-09-09--19-41-19--0"),
("CHRYSLER", "regen92783EAE66B|2022-09-09--13-15-44--0"),
("RAM", "regenBE5DAAEF30F|2022-09-13--17-06-24--0"),
("SUBARU", "regen8A363AF7E14|2022-09-13--17-20-39--0"),
("GM", "regen31EA3F9A37C|2022-09-09--21-06-36--0"),
("NISSAN", "regenAA21ADE5921|2022-09-09--19-44-37--0"),
("VOLKSWAGEN", "regenA1BF4D17761|2022-09-09--19-46-24--0"),
("MAZDA", "regen1994C97E977|2022-09-13--16-34-44--0"),
("BODY", "regenFA002A80700|2022-09-27--15-37-02--0"),
("HYUNDAI", "regenBE53A59065B|2022-09-27--16-52-03--0"),
("HYUNDAI", "regen11AA43BCA5F|2022-09-27--15-39-54--0"),
("TOYOTA", "regen929C5790007|2022-09-27--16-27-47--0"),
("TOYOTA2", "regenEA3950D7F22|2022-09-27--15-43-24--0"),
("TOYOTA3", "regen89026F6BD8D|2022-09-27--15-45-37--0"),
("HONDA", "regenC7D5645EB17|2022-09-27--15-47-29--0"),
("HONDA2", "regenCC2ECCE5742|2022-09-27--16-18-01--0"),
("CHRYSLER", "regenC253C4DAC90|2022-09-27--15-51-03--0"),
("RAM", "regen20490083AE7|2022-09-27--15-53-15--0"),
("SUBARU", "regen1E72BBDCED5|2022-09-27--15-55-31--0"),
("GM", "regen45B05A80EF6|2022-09-27--15-57-22--0"),
("NISSAN", "regenC19D899B46D|2022-09-27--15-59-13--0"),
("VOLKSWAGEN", "regenD8F7AC4BD0D|2022-09-27--16-41-45--0"),
("MAZDA", "regenFC3F9ECBB64|2022-09-27--16-03-09--0"),
]
# dashcamOnly makes don't need to be tested until a full port is done

Loading…
Cancel
Save