isaac-sim / IsaacLab

Unified framework for robot learning built on NVIDIA Isaac Sim
https://isaac-sim.github.io/IsaacLab
Other
1.59k stars 514 forks source link

[Question] How to customize provided envrioments? #438

Open saprrow opened 1 month ago

saprrow commented 1 month ago

Question

I am trying to add an in-hand camera in the Isaac-Lift-Cube-Franka-IK-Rel-v0 env. But I don't know how to customize the env. The sample code for creating env is relatively simple, as shown below.

    assert (
        args_cli.task == "Isaac-Lift-Cube-Franka-IK-Rel-v0"
    ), "Only 'Isaac-Lift-Cube-Franka-IK-Rel-v0' is supported currently."
    # parse configuration
    env_cfg = parse_env_cfg(args_cli.task, use_gpu=not args_cli.cpu, num_envs=args_cli.num_envs)

    # modify configuration such that the environment runs indefinitely
    # until goal is reached
    env_cfg.terminations.time_out = None
    # set the resampling time range to large number to avoid resampling
    env_cfg.commands.object_pose.resampling_time_range = (1.0e9, 1.0e9)
    # we want to have the terms in the observations returned as a dictionary
    # rather than a concatenated tensor
    env_cfg.observations.policy.concatenate_terms = False

    # add termination condition for reaching the goal otherwise the environment won't reset
    env_cfg.terminations.object_reached_goal = DoneTerm(func=mdp.object_reached_goal)

    # create environment
    env = gym.make(args_cli.task, cfg=env_cfg)

I'd like to know if there are some ways to customize the env_cfg for adding an inhand camera. I appreciate it if anyone could help me!

jtigue-bdai commented 1 month ago

So the identifier Isaac-Lift-Cube-Franka-IK-Rel-v0 points to a specific env config (see manager_based/manipulation/lift/config/franka/__init__)

The specific config: manager_based/manipulation/lift/config/franka/ik_rel_env_cfg.FrankaCubeLiftEnvCfg

You can modify that config by adding a camera to the __post_init__: See for details on adding a camera: add_sensors_on_robot