File size: 1,806 Bytes
1cc903b | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | """
Dataset management tool for operations requiring Isaac Sim (SimulationApp).
This script handles dataset operations that require the Isaac Sim application to be running:
- record: Record teleoperation data
- replay: Replay dataset in simulation
"""
import multiprocessing
if multiprocessing.get_start_method() != "spawn":
multiprocessing.set_start_method("spawn", force=True)
import argparse
from isaaclab.app import AppLauncher
from .utils import common, setup_record_parser, setup_replay_parser
from lehome.utils.logger import get_logger
logger = get_logger(__name__)
def main():
"""Main entry point for dataset operations requiring Isaac Sim."""
isaac_args_parser = argparse.ArgumentParser(add_help=False)
AppLauncher.add_app_launcher_args(isaac_args_parser)
parser = argparse.ArgumentParser(
description="LeHome dataset management tool",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
subparsers = parser.add_subparsers(
dest="command", help="Available commands", required=True
)
# Setup all subcommand parsers first
setup_record_parser(subparsers, [isaac_args_parser])
setup_replay_parser(subparsers, [isaac_args_parser])
args = parser.parse_args()
simulation_app = common.launch_app_from_args(args)
try:
import lehome.tasks.bedroom
from .utils import dataset_record, dataset_replay
if args.command == "record":
dataset_record.record_dataset(args, simulation_app)
elif args.command == "replay":
dataset_replay.replay(args)
except Exception as e:
logger.error(f"Error during dataset {args.command}: {e}", exc_info=True)
raise
finally:
common.close_app(simulation_app)
if __name__ == "__main__":
main()
|