mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-03-03 00:53:55 +08:00
* Added model_replay and fixed some bugs in camera_replay
* Unpack capnp logs on device
* add sync to device
* GPU now also works on PC
* update model ref
* update refs
* dont change this one
* Use pipeline calib instead of rlog calib
* remove that
* update refs
Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: bbe9accd4d
31 lines
1.1 KiB
Python
Executable File
31 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import numpy as np
|
|
|
|
from tools.lib.logreader import LogReader
|
|
from tools.lib.framereader import FrameReader
|
|
from tools.lib.cache import cache_path_for_file_path
|
|
from selfdrive.test.process_replay.camera_replay import camera_replay
|
|
|
|
|
|
if __name__ == "__main__":
|
|
lr = LogReader(os.path.expanduser('~/rlog.bz2'))
|
|
fr = FrameReader(os.path.expanduser('~/fcamera.hevc'))
|
|
desire = np.load(os.path.expanduser('~/desire.npy'))
|
|
calib = np.load(os.path.expanduser('~/calib.npy'))
|
|
|
|
try:
|
|
msgs = camera_replay(list(lr), fr, desire=desire, calib=calib)
|
|
finally:
|
|
cache_path = cache_path_for_file_path(os.path.expanduser('~/fcamera.hevc'))
|
|
if os.path.isfile(cache_path):
|
|
os.remove(cache_path)
|
|
|
|
output_size = len(np.frombuffer(msgs[0].model.rawPred, dtype=np.float32))
|
|
output_data = np.zeros((len(msgs), output_size), dtype=np.float32)
|
|
for i, msg in enumerate(msgs):
|
|
output_data[i] = np.frombuffer(msg.model.rawPred, dtype=np.float32)
|
|
np.save(os.path.expanduser('~/modeldata.npy'), output_data)
|
|
|
|
print("Finished replay")
|