Datasets:

ArXiv:
License:
File size: 1,330 Bytes
a199a9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

import sys
from pathlib import Path

import click
import rerun as rr
from loguru import logger
from nymeria.data_provider import NymeriaDataProvider
from nymeria.data_viewer import NymeriaViewer


@click.command()
@click.option(
    "-i", "sequence_dir", type=Path, required=True, help="The directory of sequence "
)
@click.option(
    "-s", "save_rrd", is_flag=True, default=False, help="Save rerun into logfile"
)
def main(sequence_dir: Path, save_rrd: bool) -> None:
    logger.remove()
    logger.add(
        sys.stdout,
        colorize=True,
        format="<level>{level: <7}</level> <blue>{name}.py:</blue><green>{function}</green><yellow>:{line}</yellow> {message}",
        level="INFO",
    )

    # See NymeriaDataProviderConfig for configuration
    nymeria_dp = NymeriaDataProvider(sequence_rootdir=sequence_dir, load_wrist=True)

    output_rrd: Path = sequence_dir / "nymeria.rrd" if save_rrd else None
    viewer = NymeriaViewer(output_rrd=output_rrd)
    viewer(nymeria_dp)
    if save_rrd:
        logger.info(f"Save visualization to {output_rrd=}")

    rr.disconnect()


if __name__ == "__main__":
    main()