39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
|
|
import argparse
|
||
|
|
|
||
|
|
from isaaclab.app import AppLauncher
|
||
|
|
|
||
|
|
parser = argparse.ArgumentParser(description="Zero agent for StackForce Isaac Lab environments.")
|
||
|
|
parser.add_argument("--disable_fabric", action="store_true", default=False)
|
||
|
|
parser.add_argument("--num_envs", type=int, default=None)
|
||
|
|
parser.add_argument("--task", type=str, default=None)
|
||
|
|
AppLauncher.add_app_launcher_args(parser)
|
||
|
|
args_cli = parser.parse_args()
|
||
|
|
|
||
|
|
app_launcher = AppLauncher(args_cli)
|
||
|
|
simulation_app = app_launcher.app
|
||
|
|
|
||
|
|
import gymnasium as gym
|
||
|
|
import torch
|
||
|
|
|
||
|
|
from isaaclab_tasks.utils import parse_env_cfg
|
||
|
|
|
||
|
|
import stackforce_simready_2foot_lab.tasks # noqa: F401
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
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)
|
||
|
|
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()
|