openpilot logs open, with the schema bundled and the GPS as a reference - #33
Merged
Merged
Conversation
…eference openpilot rlog import was listed as a limitation because it raised unless openpilot's cereal schema happened to be on the machine. It also could not have worked when the schema was there: - Logs are distributed as rlog.bz2 or rlog.zst and were read as raw capnp. They are now decompressed (zstd needs the zstandard module, and says so). - The schema was loaded without an import path, which its absolute imports need. It is now vendored under core/data/cereal (comma.ai, MIT; NOTICE beside it), with tools/fetch_cereal.py to refresh it. - Only files ending .rlog or .qlog were routed to the reader; openpilot names them rlog, rlog.bz2, qlog.zst. All of those route now, from the loader and the Open openpilot Log dialog. - A panda echoes the frames it transmits with src 128 + bus. Those were mixed into the car's traffic; they are kept apart and counted. gps_reference returns the log's GPS as reference series on the capture's clock, ready for the calibrator. On a public 2021 Toyota RAV4 drive from openpilot's CI routes: 122,282 received frames from 158 IDs on three buses, 78,896 panda transmissions kept apart, the two summing to pycapnp's own count. Calibrated against the log's own GPS, 0x0B4 bytes 5-6 come back as 0.01 km/h per bit, the figure in openpilot's DBC, and decode within 0.87% of openpilot's vEgo. Both are now phases of acceptance_new_sources.py. pycapnp is the new openpilot extra; CI installs it, the binary build installs it with mdf, and the spec collects it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why it never worked
openpilot rlog import was a listed limitation: it raised unless openpilot's cereal schema happened to be on the machine. It also could not have worked when the schema was present:
rlog.bz2orrlog.zst, and were read as raw capnp..rlog/.qlogwere routed to the reader. openpilot names its filesrlog,rlog.bz2,qlog.zst.The fix
canlab/core/openpilot_parser.pyrewritten: bz2 and zstd,read_multiple_bytes, panda transmissions kept apart and counted indf.attrs["sent_frames"](include_sent=Truekeeps them),gps_reference()returning the log's GPS asReferenceSerieson the capture's clock.canlab/core/data/cereal/(comma.ai, MIT;NOTICE.txtbeside it), refreshed bytools/fetch_cereal.py. Shipped as package data and in the binary.log_parser.is_openpilot_log()routesrlog,qlog,*.rlog,*.qlog,rlog.bz2,qlog.zst; the Open openpilot Log dialog accepts them.pycapnpis the newopenpilotextra. CI installs it; the binary build job now installsmdfandopenpilottoo, andcanlab.speccollects pycapnp. Checked locally: the built binary containscapnp/and the schema, and the bundled schema copy decodes the real log.Checked on a real drive
A public 2021 Toyota RAV4 route from openpilot's CI:
vEgo.Both are phases of
acceptance_new_sources.py(the log is fetched once, 8 MB).tests/test_openpilot_rlog.pypins the reader on logs built by hand with the vendored schema.pytest -q: 748 passed. ruff clean.