Support Multi-Log - #1083
Conversation
1. Helper Functions Extended (osgar/logger.py):
- lookup_stream_names(filename): Dynamically detects dictionary or .json path inputs, parses sub-logs, and consolidates prefixed stream
names (e.g., "nickname.original_name").
- lookup_config(filename): Recursively retrieves and aggregates local configurations mapped to their corresponding nicknames.
- lookup_stream_id(filename, stream_name): Transparently returns Virtual Stream IDs (1-based index) based on prefixed stream names.
2. Created Low-Level MultiLogReader (osgar/logger.py):
- Manages dictionary / JSON configurations, loading and instantiating individual LogReaders for each sub-log.
- Implements Timeline Reference synchronization: Computes the global reference start time T_{ref} = min(startₜimeᵢ + offsetₛecᵢ) and
aligns all packet timestamps in global time.
- Performs Chronological Stream Merging using heapq.merge over sub-generators.
- Optimized Stream Filtering (only_stream_id): Maps requested Virtual IDs back to local stream IDs to configure sub-LogReaders with
minimal file-parsing overhead.
- System Stream (Stream 0) Filtering: Explicitly filters out and skips all local metadata/system packets from sub-logs during merging to
prevent stream pollution.
3. Extended LogReaderEx (osgar/logger.py):
- Transparently handles single-log and multi-log paths.
- In multi-log mode, delegates parsing to MultiLogReader while performing automatic deserialization and friendly stream-name mapping.
|
Note, that this implementation is very fresh and I did not review it yet, but I see this feature as very valuable for further development, and coordination of multiple robots, reprocessing or recording multiple independent units. |
|
it is kind of fun: |
|
switching to draft as I am playing with it further more, but still comments are welcome :) |
|
It looks good and I might use it soon. |
|
Or just a script for creation the json configuration.. |
|
@tajgr thanks for comments. I am afraid that there will be need for the offsets?? Also the input should be for other tools like "lidarview" - do you have some use cases? Did you try it? Yes, AI suggested "auto-generated JSON", but I did not want it in the first round - in particular I would like to align timing of GPS for example. |
|
With Spider, I’m now running the driver and the application separately. That might come in handy. In future, part of the code will run on the APU and part on a second high-performance computer. It looks working for now. |
|
OK, thanks - so two computers. Do you have them somehow synchronized or what do you use for synchronization of two logfiles? |
|
For now, everything is on the APU. But as the navigation improves and sensors are added, I’ll have to move the main app to the other computer. I’ll definitely be synchronising the data, but I’m not sure how just yet. |

Multi-Log Feature Design
This document details the design and implementation strategy for the Multi-Log feature in OSGAR.
The goal of this feature is to allow users to process and replay multiple independent, temporally overlapping log files under a unified interface, as if they were reading from a single "virtual" log file.
1. Use Cases
In real-world operations, data often comes from multiple independent sources:
patandm03).To analyze these systems holistically, we need a unified time domain where streams from different logs can be accessed synchronously.
2. Configuration Schema
A Multi-Log session is defined via a JSON configuration. Each nickname maps to an object specifying the file path and an optional time offset (in seconds) to align log timelines.
If
offset_secis omitted, it defaults to0.0, which is ideal for systems that are already temporally synchronized (e.g., when multiple sensors or robots record on the same machine/network using synchronized clocks).{ "m03": { "file": "m03-matty-on-pat-redroad-260801_105050.log", "offset_sec": -1.23 }, "pat": { "file": "pat-dh26-260801_105022.log" } }