Log a complete frame of multi-modal sensor data to the visualization. This is the main data ingestion method that accepts various sensor data types and logs them to appropriate namespaces in the Rerun visualization. It handles temporal synchronization, namespace man
(
self,
pcds: Optional[List[Dict[str, Any]]] = None,
boxes: Optional[rr.Boxes3D] = None,
arrows: Optional[rr.Arrows3D] = None,
images: Optional[List[Dict[str, Any]]] = None,
frame_idx: Optional[int] = None,
timestamp_ns: Optional[int] = None,
)
| 268 | |
| 269 | def set_frame_counter(self, frame_idx: Optional[int] = None, timestamp_ns: Optional[int] = None) -> None: |
| 270 | """ |
| 271 | Advance sequence and time clocks and update current frame tracking. |
| 272 | |
| 273 | This method synchronizes the visualization timeline by setting both |
| 274 | discrete frame indices and continuous nanosecond timestamps. It's |
| 275 | typically called at the beginning of each frame update to establish |
| 276 | the temporal context for all subsequent data logging. |
| 277 | |
| 278 | Args: |
| 279 | frame_idx: Discrete frame index. If None, auto-increments from current frame. |
| 280 | Should be monotonically increasing for proper timeline navigation. |
| 281 | timestamp_ns: Nanosecond timestamp for precise time synchronization. |
| 282 | If None, only the frame sequence is updated. |
| 283 | """ |
| 284 | if frame_idx is not None: |
| 285 | rr.set_time("frame_idx", sequence=frame_idx) |
| 286 | self.curr_frame_idx = frame_idx |
| 287 | else: |
| 288 | rr.set_time("frame_idx", sequence=self.curr_frame_idx) |
| 289 | self.curr_frame_idx += 1 |
| 290 | |
| 291 | if timestamp_ns is not None: |
| 292 | rr.set_time("time", timestamp=np.datetime64(timestamp_ns, "ns")) |
| 293 | |
| 294 | def clear_empty_namespaces(self, curr_stream_set: Dict[str, Set[str]]) -> None: |
| 295 | """ |
| 296 | Clear stale data by logging empty entities to unused namespaces. |
| 297 | |
| 298 | Args: |
| 299 | curr_stream_set: Dictionary mapping stream types to sets of active |
| 300 | namespace strings for the current frame. Should contain entries |
| 301 | for all stream types in self.stream_names. |
| 302 | """ |
| 303 | for stream_type in self.stream_namespaces: |
| 304 | for namespace in self.stream_namespaces[stream_type]: |
| 305 | if namespace not in curr_stream_set[stream_type]: |
| 306 | rr.log(namespace, self.empty_messages[stream_type]) |
| 307 | # Track namespaces seen so far (grow-only) |
| 308 | self.stream_namespaces[stream_type].update(curr_stream_set[stream_type]) |
| 309 | |
| 310 | def add_data( |
| 311 | self, |
| 312 | pcds: Optional[List[Dict[str, Any]]] = None, |
| 313 | boxes: Optional[rr.Boxes3D] = None, |
| 314 | arrows: Optional[rr.Arrows3D] = None, |
| 315 | images: Optional[List[Dict[str, Any]]] = None, |
| 316 | frame_idx: Optional[int] = None, |
| 317 | timestamp_ns: Optional[int] = None, |
| 318 | ) -> None: |
| 319 | """ |
| 320 | Log a complete frame of multi-modal sensor data to the visualization. |
| 321 | |
| 322 | This is the main data ingestion method that accepts various sensor data |
| 323 | types and logs them to appropriate namespaces in the Rerun visualization. |
| 324 | It handles temporal synchronization, namespace management, and automatic |
| 325 | cleanup of stale data streams. |
| 326 | |
| 327 | Args: |
no test coverage detected