| |
| |
| |
| |
|
|
| """Script to run an environment with zero action agent.""" |
|
|
| """Launch Isaac Sim Simulator first.""" |
|
|
| import argparse |
|
|
| from isaaclab.app import AppLauncher |
|
|
| |
| parser = argparse.ArgumentParser(description="Zero agent for Isaac Lab environments.") |
| parser.add_argument( |
| "--disable_fabric", action="store_true", default=False, help="Disable fabric and use USD I/O operations." |
| ) |
| parser.add_argument("--num_envs", type=int, default=None, help="Number of environments to simulate.") |
| parser.add_argument("--task", type=str, default=None, help="Name of the task.") |
| |
| AppLauncher.add_app_launcher_args(parser) |
| |
| args_cli = parser.parse_args() |
|
|
| |
| app_launcher = AppLauncher(args_cli) |
| simulation_app = app_launcher.app |
|
|
| """Rest everything follows.""" |
|
|
| import gymnasium as gym |
| import torch |
|
|
| import isaaclab_tasks |
| from isaaclab_tasks.utils import parse_env_cfg |
|
|
| |
|
|
|
|
| def main(): |
| """Zero actions agent with Isaac Lab environment.""" |
| |
| env_cfg = parse_env_cfg( |
| args_cli.task, device=args_cli.device, num_envs=args_cli.num_envs, use_fabric=not args_cli.disable_fabric |
| ) |
| |
| env = gym.make(args_cli.task, cfg=env_cfg) |
|
|
| |
| print(f"[INFO]: Gym observation space: {env.observation_space}") |
| print(f"[INFO]: Gym action space: {env.action_space}") |
| |
| env.reset() |
| |
| while simulation_app.is_running(): |
| |
| with torch.inference_mode(): |
| |
| actions = torch.zeros(env.action_space.shape, device=env.unwrapped.device) |
| |
| env.step(actions) |
|
|
| |
| env.close() |
|
|
|
|
| if __name__ == "__main__": |
| |
| main() |
| |
| simulation_app.close() |
|
|