mani_skill.trajectory.replay_trajectory#
Replay ManiSkill trajectories stored in HDF5 (.h5) format
The replayed trajectory can use different observation modes and control modes.
We support translating actions from certain controllers to a limited number of controllers.
The script is only tested for Panda, and may include some Panda-specific hardcode.
Classes#
Functions#
|
|
|
|
|
|
|
|
|
|
|
|
|
sanity checks the trajectory seed aligns with the episode seed. reformats the reset kwargs seed if missing or formatted wrong |
Module Contents#
- class mani_skill.trajectory.replay_trajectory.Args[source]#
- allow_failure: bool = False[source]#
Whether to include episodes that fail in saved videos and trajectory data based on the environment’s evaluation returned “success” label
- count: int | None = None[source]#
Number of demonstrations to replay before exiting. By default will replay all demonstrations
- discard_timeout: bool = False[source]#
Whether to discard episodes that timeout and are truncated (depends on the max_episode_steps parameter of task)
- max_retry: int = 0[source]#
Maximum number of times to try and replay a trajectory until the task reaches a success state at the end.
- num_envs: Annotated[int, tyro.conf.arg(aliases=['-n'])] = 1[source]#
Number of environments to run to replay trajectories. With CPU backends typically this is parallelized via python multiprocessing. For parallelized simulation backends like physx_gpu, this is parallelized within a single python process by leveraging the GPU.
- obs_mode: Annotated[Optional[str], tyro.conf.arg(aliases=['-o'])] = None[source]#
Target observation mode to record in the trajectory. See https://maniskill.readthedocs.io/en/latest/user_guide/concepts/observation.html for a full list of supported observation modes.
- render_mode: str = 'rgb_array'[source]#
The render mode used for saving videos. Typically there is also ‘sensors’ and ‘all’ render modes which further render all sensor outputs like cameras.
- reward_mode: str | None = None[source]#
Specifies the reward type that the env should use. By default it will pick the first supported reward mode. Most environments support ‘sparse’, ‘none’, and some further support ‘normalized_dense’ and ‘dense’ reward modes
- save_traj: bool = False[source]#
Whether to save trajectories to disk. This will not override the original trajectory file.
- shader: str | None = None[source]#
Change shader used for rendering for all cameras. Default is none meaning it will use whatever was used in the original data collection or the environment default. Can also be ‘rt’ for ray tracing and generating photo-realistic renders. Can also be ‘rt-fast’ for a faster but lower quality ray-traced renderer
- sim_backend: Annotated[Optional[str], tyro.conf.arg(aliases=['-b'])] = None[source]#
Which simulation backend to use. Can be ‘physx_cpu’, ‘physx_gpu’. If not specified the backend used is the same as the one used to collect the trajectory data.
- target_control_mode: Annotated[Optional[str], tyro.conf.arg(aliases=['-c'])] = None[source]#
Target control mode to convert the demonstration actions to. Note that not all control modes can be converted to others successfully and not all robots have easy to convert control modes. Currently the Panda robots are the best supported when it comes to control mode conversion. Furthermore control mode conversion is not supported in GPU parallelized environments.
- use_env_states: bool = False[source]#
Whether to replay by environment states instead of actions. This guarantees that the environment will look exactly the same as the original trajectory at every step.
- use_first_env_state: bool = False[source]#
Use the first env state in the trajectory to set initial state. This can be useful for trying to replay demonstrations collected in the CPU simulation in the GPU simulation by first starting with the same initial state as GPU simulated tasks will randomize initial states differently despite given the same seed compared to CPU sim.
- mani_skill.trajectory.replay_trajectory._main(args, use_cpu_backend, env_id, env_kwargs, ori_env_kwargs, record_episode_kwargs, proc_id=0, num_procs=1)[source]#
- Parameters:
args (Args) –
proc_id (int) –
- mani_skill.trajectory.replay_trajectory.replay_cpu_sim(args, env, ori_env, pbar, episodes, trajectories)[source]#
- Parameters:
args (Args) –