File size: 1,241 Bytes
406662d | 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 | # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""Launch Isaac Sim Simulator first."""
from isaaclab.app import AppLauncher
# launch omniverse app
simulation_app = AppLauncher(headless=True).app
"""Rest everything follows."""
from collections import namedtuple
import pytest
from isaaclab.envs.mdp import NullCommandCfg
@pytest.fixture
def env():
"""Create a dummy environment."""
return namedtuple("ManagerBasedRLEnv", ["num_envs", "dt", "device"])(20, 0.1, "cpu")
def test_str(env):
"""Test the string representation of the command manager."""
cfg = NullCommandCfg()
command_term = cfg.class_type(cfg, env)
# print the expected string
print()
print(command_term)
def test_compute(env):
"""Test the compute function. For null command generator, it does nothing."""
cfg = NullCommandCfg()
command_term = cfg.class_type(cfg, env)
# test the reset function
command_term.reset()
# test the compute function
command_term.compute(dt=env.dt)
# expect error
with pytest.raises(RuntimeError):
command_term.command
|