| | |
| | |
| | |
| | |
| |
|
| | """ |
| | This script demonstrates how to run IsaacSim via the AppLauncher |
| | |
| | .. code-block:: bash |
| | |
| | # Usage |
| | ./isaaclab.sh -p scripts/tutorials/00_sim/launch_app.py |
| | |
| | """ |
| |
|
| | """Launch Isaac Sim Simulator first.""" |
| |
|
| |
|
| | import argparse |
| |
|
| | from isaaclab.app import AppLauncher |
| |
|
| | |
| | parser = argparse.ArgumentParser(description="Tutorial on running IsaacSim via the AppLauncher.") |
| | parser.add_argument("--size", type=float, default=1.0, help="Side-length of cuboid") |
| | |
| | parser.add_argument( |
| | "--width", type=int, default=1280, help="Width of the viewport and generated images. Defaults to 1280" |
| | ) |
| | parser.add_argument( |
| | "--height", type=int, default=720, help="Height of the viewport and generated images. Defaults to 720" |
| | ) |
| |
|
| | |
| | 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 isaaclab.sim as sim_utils |
| |
|
| |
|
| | def design_scene(): |
| | """Designs the scene by spawning ground plane, light, objects and meshes from usd files.""" |
| | |
| | cfg_ground = sim_utils.GroundPlaneCfg() |
| | cfg_ground.func("/World/defaultGroundPlane", cfg_ground) |
| |
|
| | |
| | cfg_light_distant = sim_utils.DistantLightCfg( |
| | intensity=3000.0, |
| | color=(0.75, 0.75, 0.75), |
| | ) |
| | cfg_light_distant.func("/World/lightDistant", cfg_light_distant, translation=(1, 0, 10)) |
| |
|
| | |
| | cfg_cuboid = sim_utils.CuboidCfg( |
| | size=[args_cli.size] * 3, |
| | visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 1.0, 1.0)), |
| | ) |
| | |
| | cfg_cuboid.func("/World/Object", cfg_cuboid, translation=(0.0, 0.0, args_cli.size / 2)) |
| |
|
| |
|
| | def main(): |
| | """Main function.""" |
| |
|
| | |
| | sim_cfg = sim_utils.SimulationCfg(dt=0.01, device=args_cli.device) |
| | sim = sim_utils.SimulationContext(sim_cfg) |
| | |
| | sim.set_camera_view([2.0, 0.0, 2.5], [-0.5, 0.0, 0.5]) |
| |
|
| | |
| | design_scene() |
| |
|
| | |
| | sim.reset() |
| | |
| | print("[INFO]: Setup complete...") |
| |
|
| | |
| | while simulation_app.is_running(): |
| | |
| | sim.step() |
| |
|
| |
|
| | if __name__ == "__main__": |
| | |
| | main() |
| | |
| | simulation_app.close() |
| |
|