tools: add MultiLogIterator example to readme (#23917)

* update LogReader doc

use MultiLogIterator to read the entire route, get timestamps and deal with exceptions

* bring back the old example

* clean f-strings

* simplify

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: da50930450
taco
xx979xx 4 years ago committed by GitHub
parent 388ae5e59e
commit 663579dd78
  1. 18
      tools/lib/README.md

@ -31,3 +31,21 @@ for msg in lr:
if msg.which() == "carState":
print(msg.carState.steeringAngleDeg)
```
### MultiLogIterator
`MultiLogIterator` is similar to `LogReader`, but reads multiple logs.
```python
from tools.lib.route import Route
from tools.lib.logreader import MultiLogIterator
# setup a MultiLogIterator to read all the logs in the route
r = Route("4cf7a6ad03080c90|2021-09-29--13-46-36")
lr = MultiLogIterator(r.log_paths())
# print all the steering angles values from all the logs in the route
for msg in lr:
if msg.which() == "carState":
print(msg.carState.steeringAngleDeg)
```

Loading…
Cancel
Save