### Run SDG Getting Started Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_getting_started.html Execute the SDG getting started example script. Use 'python.bat' on Windows. ```bash ./python.sh standalone_examples/api/isaacsim.replicator.examples/sdg_getting_started_02.py ``` -------------------------------- ### Complete Hello World Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/core_api_tutorials/tutorial_core_hello_world.html A complete example demonstrating scene setup, object creation, and property inspection using the Core API. ```python 1import isaacsim.core.experimental.utils.stage as stage_utils 2import numpy as np 3from isaacsim.core.experimental.materials import PreviewSurfaceMaterial 4from isaacsim.core.experimental.objects import Cube 5from isaacsim.core.experimental.prims import GeomPrim, RigidPrim 6from isaacsim.examples.base.base_sample_experimental import BaseSample 7from isaacsim.storage.native import get_assets_root_path 8 9 10class HelloWorld(BaseSample): 11 def __init__(self) -> None: 12 super().__init__() 13 14 def setup_scene(self): 15 # Add ground plane 16 ground_plane = stage_utils.add_reference_to_stage( 17 usd_path=get_assets_root_path() + "/Isaac/Environments/Grid/default_environment.usd", 18 path="/World/ground", 19 ) 20 21 # Create a blue visual material for the cube 22 visual_material = PreviewSurfaceMaterial("/World/Materials/blue") 23 visual_material.set_input_values("diffuseColor", [0.0, 0.0, 1.0]) 24 25 # Create the cube geometry 26 self._cube_shape = Cube( 27 paths="/World/fancy_cube", 28 positions=np.array([[0.0, 0.0, 1.0]]), 29 sizes=[1.0], 30 scales=np.array([[0.5015, 0.5015, 0.5015]]), 31 reset_xform_op_properties=True, 32 ) 33 34 # Apply collision and rigid body 35 GeomPrim(paths=self._cube_shape.paths, apply_collision_apis=True) 36 self._cube = RigidPrim(paths=self._cube_shape.paths) 37 self._cube_shape.apply_visual_materials(visual_material) 38 39 # This function is called after load button is pressed 40 # It's called once, after both setup_scene and one physics time step has finished 41 # to propagate physics handles needed to retrieve physical properties 42 async def setup_post_load(self): 43 # -- Begin query properties -- # 44 # Query cube properties using RigidPrim methods 45 positions, orientations = self._cube.get_world_poses() 46 # get_velocities() returns a tuple: (linear_velocities, angular_velocities) 47 linear_velocities, angular_velocities = self._cube.get_velocities() 48 49 # Convert from warp arrays to numpy for printing 50 # Note: experimental APIs return batched results (even for single objects) 51 print("Cube position is : " + str(positions.numpy()[0])) 52 print("Cube's orientation is : " + str(orientations.numpy()[0])) 53 print("Cube's linear velocity is : " + str(linear_velocities.numpy()[0])) 54 # -- End of query properties -- # ``` -------------------------------- ### Windows Installation Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/installation/install_workstation.html Example commands for installing Isaac Sim on a Windows system. This includes creating a directory, extracting the zip archive, running the post-installation batch script, and launching the application. ```batch mkdir C:\isaacsim cd %USERPROFILE%/Downloads tar -xvzf "isaac-sim-standalone-6.0.1-windows-x86_64.zip" -C C:\isaacsim cd C:\isaacsim post_install.bat isaac-sim.bat ``` -------------------------------- ### Example Setup and Execution Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_cosmos.html Sets up the environment and runs the SDG pipeline example with specified capture parameters. Closes the simulation application upon completion. ```python # Setup the environment and run the example run_example( num_clips=NUM_CLIPS, num_frames_per_clip=NUM_FRAMES_PER_CLIP, capture_interval=CAPTURE_INTERVAL, start_delay=START_DELAY, use_instance_id=True, ) simulation_app.close() ``` -------------------------------- ### GettingStarted Class API Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/extensions/isaacsim.examples.interactive/config/python_api.html Methods for setting up the scene, managing simulation states, and cleaning up physics resources for the Getting Started example. ```APIDOC ## class GettingStarted(BaseSample) ### Description Represents the Getting Started sample, providing functionalities for scene setup, simulation state management, and physics cleanup. ### Methods - `__init__(self)`: Constructor for the GettingStarted class. - `setup_scene(self)`: Configures the simulation scene. - `setup_post_load(self)`: Asynchronous method called after the scene is loaded. - `setup_pre_reset(self)`: Asynchronous method called before resetting the simulation. - `setup_post_reset(self)`: Asynchronous method called after resetting the simulation. - `setup_post_clear(self)`: Asynchronous method called after clearing the scene. - `physics_cleanup(self)`: Cleans up physics-related resources. ``` -------------------------------- ### Linux x86_64 Installation Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/installation/install_workstation.html Example commands for installing Isaac Sim on a Linux x86_64 system. This includes creating a directory, unzipping the package, running the post-installation script, and launching the application. ```bash mkdir ~/isaacsim cd ~/Downloads unzip "isaac-sim-standalone-6.0.1-linux-x86_64.zip" -d ~/isaacsim cd ~/isaacsim ./post_install.sh ./isaac-sim.sh ``` -------------------------------- ### Complete Hello World Scene Setup Source: https://docs.isaacsim.omniverse.nvidia.com/latest/core_api_tutorials/tutorial_core_hello_world.html This complete example sets up the scene by adding a ground plane and a dynamic cube with a blue visual material. Save and hot-reload to see the simulation. ```python # -- Import Isaac sim packages -- # import isaacsim.core.experimental.utils.stage as stage_utils import numpy as np from isaacsim.core.experimental.materials import PreviewSurfaceMaterial from isaacsim.core.experimental.objects import Cube from isaacsim.core.experimental.prims import GeomPrim, RigidPrim from isaacsim.examples.base.base_sample_experimental import BaseSample from isaacsim.storage.native import get_assets_root_path # -- End of import Isaac sim packages -- # class HelloWorld(BaseSample): def __init__(self) -> None: super().__init__() def setup_scene(self): # Add ground plane ground_plane = stage_utils.add_reference_to_stage( usd_path=get_assets_root_path() + "/Isaac/Environments/Grid/default_environment.usd", path="/World/ground", ) # -- Creating a cube and apply materials -- # # Create a blue visual material for the cube visual_material = PreviewSurfaceMaterial("/World/Materials/blue") visual_material.set_input_values("diffuseColor", [0.0, 0.0, 1.0]) # Create the cube geometry self._cube_shape = Cube( paths="/World/fancy_cube", positions=np.array([[0.0, 0.0, 1.0]]), # Starting position 1m above ground sizes=[1.0], scales=np.array([[0.5015, 0.5015, 0.5015]]), # Scale the cube reset_xform_op_properties=True, ) # Apply collision APIs to enable physics collision GeomPrim(paths=self._cube_shape.paths, apply_collision_apis=True) # Make it a rigid body (dynamic object that responds to physics) self._cube = RigidPrim(paths=self._cube_shape.paths) # Apply the blue material self._cube_shape.apply_visual_materials(visual_material) # -- End of creating a cube and apply materials -- # ``` -------------------------------- ### Replicator Run Example Setup Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_augmentation.html Sets up the Replicator capture pipeline, including stage opening, seed setting, and disabling capture on play. ```Python def run_example(num_frames: int, resolution: tuple[int, int], use_warp: bool, env_url: str | None = None) -> float: """Run the capture pipeline using step() to trigger a randomization and data capture.""" print(f"Running example with num_frames: {num_frames}, resolution: {resolution}, use_warp: {use_warp}") if env_url is not None and env_url != "": assets_root_path = get_assets_root_path() stage_path = assets_root_path + env_url print(f"Opening stage: {stage_path}") open_stage(stage_path) else: omni.usd.get_context().new_stage() rep.functional.create.dome_light(intensity=1000, rotation=(270, 0, 0)) ground_plane = rep.functional.create.plane(scale=(10, 10, 1), position=(0, 0, 0)) rep.functional.physics.apply_collider(ground_plane) # Use a fixed global seed for reproducibility rep.set_global_seed(SEED) # Disable capture on play, data is captured manually using the step function rep.orchestrator.set_capture_on_play(False) # Set DLSS to Quality mode (2) for best SDG results (Options: 0 (Performance), 1 (Balanced), 2 (Quality), 3 (Auto) carb.settings.get_settings().set("rtx/post/dlss/execMode", 2) # Augment the annotators rgb_to_hsv_augm = rep.annotators.Augmentation.from_function(rep.augmentations_default.aug_rgb_to_hsv) hsv_to_rgb_augm = rep.annotators.Augmentation.from_function(rep.augmentations_default.aug_hsv_to_rgb) # Augment the RGB and depth annotators gn_rgb_augm = rep.annotators.Augmentation.from_function( gaussian_noise_rgb_wp if use_warp else gaussian_noise_rgb_np, sigma=15.0, seed=SEED ) gn_depth_augm = rep.annotators.get_augmentation("gn_depth_wp" if use_warp else "gn_depth_np") ``` -------------------------------- ### Complete Hello World Application Source: https://docs.isaacsim.omniverse.nvidia.com/latest/core_api_tutorials/tutorial_core_hello_world.html A complete example demonstrating scene setup, object creation, physics callback registration, and property inspection within an Isaac Sim application. ```python import isaacsim.core.experimental.utils.stage as stage_utils import numpy as np from isaacsim.core.experimental.materials import PreviewSurfaceMaterial from isaacsim.core.experimental.objects import Cube from isaacsim.core.experimental.prims import GeomPrim, RigidPrim # -- Begin loading SimulationManager -- # from isaacsim.core.simulation_manager import SimulationManager # -- End of loading SimulationManager -- # from isaacsim.examples.base.base_sample_experimental import BaseSample from isaacsim.storage.native import get_assets_root_path class HelloWorld(BaseSample): def __init__(self) -> None: super().__init__() self._physics_callback_id = None def setup_scene(self): # Add ground plane ground_plane = stage_utils.add_reference_to_stage( usd_path=get_assets_root_path() + "/Isaac/Environments/Grid/default_environment.usd", path="/World/ground", ) # Create a blue visual material for the cube visual_material = PreviewSurfaceMaterial("/World/Materials/blue") visual_material.set_input_values("diffuseColor", [0.0, 0.0, 1.0]) # Create the cube geometry self._cube_shape = Cube( paths="/World/fancy_cube", positions=np.array([[0.0, 0.0, 1.0]]), sizes=[1.0], scales=np.array([[0.5015, 0.5015, 0.5015]]), reset_xform_op_properties=True, ) # Apply collision and rigid body GeomPrim(paths=self._cube_shape.paths, apply_collision_apis=True) self._cube = RigidPrim(paths=self._cube_shape.paths) self._cube_shape.apply_visual_materials(visual_material) async def setup_post_load(self): # -- Begin registering callback -- # # Register a physics callback using SimulationManager from isaacsim.core.simulation_manager.impl.isaac_events import IsaacEvents self._physics_callback_id = SimulationManager.register_callback( self.print_cube_info, IsaacEvents.POST_PHYSICS_STEP ) # -- End of registering callback -- # # Physics callback function - called after each physics step # Takes dt (delta time) and context as arguments def print_cube_info(self, dt, context): positions, orientations = self._cube.get_world_poses() linear_velocities, angular_velocities = self._cube.get_velocities() print("Cube position is : " + str(positions.numpy()[0])) print("Cube's orientation is : " + str(orientations.numpy()[0])) print("Cube's linear velocity is : " + str(linear_velocities.numpy()[0])) def physics_cleanup(self): # -- Begin deregistering callback -- # # Clean up callback when the extension is unloaded if self._physics_callback_id is not None: SimulationManager.deregister_callback(self._physics_callback_id) self._physics_callback_id = None # -- End of deregistering callback -- # ``` -------------------------------- ### Start SDG Pipeline Example Execution Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_cosmos.html This snippet shows how to initiate the SDG pipeline example asynchronously with specified parameters for clips, frames, and capture intervals. ```python # Setup the environment and run the example asyncio.ensure_future( run_example_async( num_clips=NUM_CLIPS, num_frames_per_clip=NUM_FRAMES_PER_CLIP, capture_interval=CAPTURE_INTERVAL, start_delay=START_DELAY, use_instance_id=True, ) ) ``` -------------------------------- ### Run Replicator Example Script Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_getting_started.html Execute the Replicator getting started example script from the command line. Use python.bat on Windows. ```bash ./python.sh standalone_examples/api/isaacsim.replicator.examples/sdg_getting_started_01.py ``` -------------------------------- ### Setup Example Scene with Obstacles Source: https://docs.isaacsim.omniverse.nvidia.com/latest/motion_generation/scene_interaction.html This function sets up a basic example scene with various obstacles and meshes. It demonstrates how to create primitives, apply collision APIs, and configure rigid bodies. The scene can be sourced from USD files, procedural generation, or other sources. ```python def setup_scene() -> None: """Create a simple example scene with obstacles. The scene is created from the default template which includes a ground plane, lights, etc. In practice, your scene could come from: - A USD file loaded via open_stage() - Procedurally generated content - A database or asset library - Any other source - the Motion Generation API doesn't care where the scene comes from """ # Create a new stage from default template (includes ground plane, lights, etc.) stage_utils.create_new_stage(template="default stage") stage_utils.set_stage_units(meters_per_unit=1.0) # Add some example obstacles # These will be found by SceneQuery and synchronized via WorldBinding Cube("/World/Obstacle1", positions=[-1.0, 1.0, 0.6], sizes=0.4) Sphere("/World/Obstacle2", positions=[1.0, 0.0, 0.75], radii=0.2) # Apply collision APIs to obstacles so they can be found by SceneQuery GeomPrim(["/World/Obstacle1", "/World/Obstacle2"], apply_collision_apis=True) # Make obstacles rigid bodies so they fall under gravity RigidPrim(["/World/Obstacle1", "/World/Obstacle2"], masses=1.0) # Add two simple meshes # Mesh1: Will use default OBB representation with large safety tolerance # we will start with mesh with some initial orientation. angle = np.pi / 4 Mesh( "/World/Mesh1", primitives="Cube", positions=[-1.5, -1.5, 0.5], scales=[0.5, 0.5, 0.1], # create quaternion: orientations=[np.cos(angle / 2), np.sin(angle / 2), 0.0, 0.0], ) # Mesh2: Will be overridden to use TRIANGULATED_MESH with small safety tolerance # This mesh might need more faithful representation for interaction Mesh("/World/Mesh2", primitives="Sphere", positions=[0.0, 1.5, 0.3], scales=[0.3, 0.3, 0.3]) # Apply collision APIs to meshes so they can be found by SceneQuery mesh_geom = GeomPrim(["/World/Mesh1", "/World/Mesh2"], apply_collision_apis=True) # Set collision approximation to convexHull - this is for physics simulation, # and is independent of the motion generation library representation! mesh_geom.set_collision_approximations(["convexHull", "convexHull"]) # Make meshes rigid bodies so they fall under gravity RigidPrim(["/World/Mesh1", "/World/Mesh2"], masses=[1.0, 1.0]) # Set camera view ViewportManager.set_camera_view("/OmniverseKit_Persp", eye=[3.0, 3.0, 2.0], target=[0.0, 0.0, 0.5]) print("Scene setup complete") ``` -------------------------------- ### Run Standalone Replicator Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_getting_started.html Executes the SDG getting started example script for batch randomization and performance comparison. Use python.bat on Windows. ```bash ./python.sh standalone_examples/api/isaacsim.replicator.examples/sdg_getting_started_05.py ``` -------------------------------- ### Setup and Data Generation with Event Observers Source: https://docs.isaacsim.omniverse.nvidia.com/latest/action_and_event_data_generation/ext_replicator-agent/ext_isaacsim_replicator_agent_configuration_editor.html This Python script demonstrates an example workflow for setting up a simulation and starting data generation using the Replicator Agent. It utilizes carb event dispatchers to observe completion events for both setup and data generation phases, ensuring sequential execution. ```python import tempfile from pathlib import Path import carb from isaacsim.replicator.agent.core.events import IRAEvents from isaacsim.replicator.agent.ui import ( get_config_file_path, load_config_file, setup_simulation, start_data_generation, update_config, ) # Skipping actual simulation setup and data generation by default for brevity RUN_SETUP = False def on_setup_done(event): """Callback for when simulation setup is done.""" carb.log_info("Simulation setup done") start_data_generation() handle_setup.reset() def on_data_done(event): """Callback for when data generation is done.""" carb.log_info("Data generation done") handle_data.reset() # Set up callbacks for setup simulation and data generation dispatcher = carb.eventdispatcher.get_eventdispatcher() handle_setup = dispatcher.observe_event( event_name=IRAEvents.SET_UP_SIMULATION_DONE_EVENT, on_event=on_setup_done, observer_name="setup_done_observer", ) handle_data = dispatcher.observe_event( event_name=IRAEvents.DATA_GENERATION_DONE_EVENT, on_event=on_data_done, observer_name="data_done_observer", ) config_path = get_config_file_path() if config_path: target_config_path = Path(config_path).parent / "full_pipeline.yaml" else: print("No config file path found") target_config_path = None if target_config_path and load_config_file(target_config_path): temp_path = Path(tempfile.mkdtemp(prefix="IRA_Output_")) update_config("simulation_duration", 2.0) update_config("replicator.writers.IRABasicWriter.output_dir", str(temp_path)) if RUN_SETUP: setup_simulation() print(f"Generating data to: {temp_path}") # When setup is done, SET_UP_SIMULATION_DONE_EVENT will fire # calling our local on_setup_done(), which in turn calls start_data_generation() # If setup_simulation() was not run, the event callbacks never fire; unsubscribe here. # When RUN_SETUP is True, on_setup_done/on_data_done reset the handles when events fire. if not RUN_SETUP: handle_setup.reset() handle_data.reset() ``` -------------------------------- ### Linux aarch64 Installation Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/installation/install_workstation.html Example commands for installing Isaac Sim on a Linux aarch64 system. This includes creating a directory, unzipping the package, running the post-installation script, and launching the application. ```bash mkdir ~/isaacsim cd ~/Downloads unzip "isaac-sim-standalone-6.0.1-linux-aarch64.zip" -d ~/isaacsim cd ~/isaacsim ./post_install.sh ./isaac-sim.sh ``` -------------------------------- ### Launch Simple Decider Network Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/cortex_tutorials/tutorial_cortex_2_decider_networks.html Execute this command to start a simple decider network example. Observe console output and interact with the robot's end-effector in the simulation. ```bash isaac_python franka_examples_main.py --behavior=simple_decider_network ``` -------------------------------- ### Python: Franka Kinematics Example Setup Source: https://docs.isaacsim.omniverse.nvidia.com/latest/manipulators/manipulators_lula_kinematics.html Sets up the LulaKinematicsSolver and ArticulationKinematicsSolver for a Franka robot. Ensure robot description and URDF files are correctly specified. This is used to compute inverse kinematics for robot movement. ```python import os import carb import numpy as np from isaacsim.core.prims import SingleArticulation as Articulation from isaacsim.core.prims import SingleXFormPrim as XFormPrim from isaacsim.core.utils.extensions import get_extension_path_from_name from isaacsim.core.utils.numpy.rotations import euler_angles_to_quats from isaacsim.core.utils.stage import add_reference_to_stage from isaacsim.robot_motion.motion_generation import ( ArticulationKinematicsSolver, LulaKinematicsSolver, interface_config_loader, ) from isaacsim.storage.native import get_assets_root_path class FrankaKinematicsExample: def __init__(self): self._kinematics_solver = None self._articulation_kinematics_solver = None self._articulation = None self._target = None def load_example_assets(self): # Add the Franka and target to the stage robot_prim_path = "/panda" path_to_robot_usd = get_assets_root_path() + "/Isaac/Robots/FrankaRobotics/FrankaPanda/franka.usd" add_reference_to_stage(path_to_robot_usd, robot_prim_path) self._articulation = Articulation(robot_prim_path) add_reference_to_stage(get_assets_root_path() + "/Isaac/Props/UIElements/frame_prim.usd", "/World/target") self._target = XFormPrim("/World/target", scale=[0.04, 0.04, 0.04]) self._target.set_default_state(np.array([0.3, 0, 0.5]), euler_angles_to_quats([0, np.pi, 0])) # Return assets that were added to the stage so that they can be registered with the core.World return self._articulation, self._target def setup(self): # Load a URDF and Lula Robot Description File for this robot: mg_extension_path = get_extension_path_from_name("isaacsim.robot_motion.motion_generation") kinematics_config_dir = os.path.join(mg_extension_path, "motion_policy_configs") self._kinematics_solver = LulaKinematicsSolver( robot_description_path=kinematics_config_dir + "/franka/rmpflow/robot_descriptor.yaml", urdf_path=kinematics_config_dir + "/franka/lula_franka_gen.urdf", ) # Kinematics for supported robots can be loaded with a simpler equivalent # print("Supported Robots with a Lula Kinematics Config:", interface_config_loader.get_supported_robots_with_lula_kinematics()) # kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config("Franka") # self._kinematics_solver = LulaKinematicsSolver(**kinematics_config) print("Valid frame names at which to compute kinematics:", self._kinematics_solver.get_all_frame_names()) end_effector_name = "right_gripper" self._articulation_kinematics_solver = ArticulationKinematicsSolver( self._articulation, self._kinematics_solver, end_effector_name ) def update(self, step: float): target_position, target_orientation = self._target.get_world_pose() # Track any movements of the robot base robot_base_translation, robot_base_orientation = self._articulation.get_world_pose() self._kinematics_solver.set_robot_base_pose(robot_base_translation, robot_base_orientation) action, success = self._articulation_kinematics_solver.compute_inverse_kinematics( target_position, target_orientation ) if success: self._articulation.apply_action(action) else: carb.log_warn("IK did not converge to a solution. No action is being taken") # Unused Forward Kinematics: # ee_position,ee_rot_mat = articulation_kinematics_solver.compute_end_effector_pose() def reset(self): # Kinematics is stateless pass ``` -------------------------------- ### Basic Newton Physics Scene Setup Source: https://docs.isaacsim.omniverse.nvidia.com/latest/physics/newton_physics.html Demonstrates setting up a basic physics scene with Newton, including creating a physics scene, a ground plane, and a dynamic cube. The simulation is then started. ```python import omni.kit.actions.core import omni.timeline import omni.usd from isaacsim.core.experimental.objects import Cube, Plane from isaacsim.core.simulation_manager import SimulationManager from isaacsim.core.simulation_manager.impl.mjc_scene import NewtonMjcScene from pxr import Sdf, UsdGeom, UsdLux, UsdPhysics omni.usd.get_context().new_stage() SimulationManager.switch_physics_engine("newton") stage = omni.usd.get_context().get_stage() # Enable camera light and add distant light action_registry = omni.kit.actions.core.get_action_registry() action_registry.get_action("omni.kit.viewport.menubar.lighting", "set_lighting_mode_camera").execute() UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight")).CreateIntensityAttr(500) # Create physics scene mjc_scene = NewtonMjcScene("/World/PhysicsScene") mjc_scene.set_gravity((0.0, 0.0, -9.81)) # Create ground plane (collision + visual) UsdGeom.Xform.Define(stage, "/World/GroundPlane") Plane("/World/GroundPlane/CollisionPlane", axes="Z") UsdPhysics.CollisionAPI.Apply(stage.GetPrimAtPath("/World/GroundPlane/CollisionPlane")) visual_mesh = UsdGeom.Mesh.Define(stage, "/World/GroundPlane/VisualMesh") size = 50.0 visual_mesh.CreatePointsAttr([(-size, -size, 0), (size, -size, 0), (size, size, 0), (-size, size, 0)]) visual_mesh.CreateFaceVertexCountsAttr([4]) visual_mesh.CreateFaceVertexIndicesAttr([0, 1, 2, 3]) visual_mesh.CreateDisplayColorAttr([(0.5, 0.5, 0.5)]) # Create dynamic cube Cube("/World/Cube", sizes=0.5, positions=[[0.0, 0.0, 2.0]]) cube_prim = stage.GetPrimAtPath("/World/Cube") UsdPhysics.CollisionAPI.Apply(cube_prim) UsdPhysics.RigidBodyAPI.Apply(cube_prim) # Start simulation timeline = omni.timeline.get_timeline_interface() timeline.play() ``` -------------------------------- ### Async Example Runner with SDG Setup Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_scene_based_sdg.html An asynchronous function to set up the scene for SDG, including loading environments, initializing randomization, and spawning objects like forklifts and pallets with random poses. ```python async def run_example_async(config): assets_root_path = await get_assets_root_path_async() if assets_root_path is None: print("[SDG] Could not get nucleus server path") return # Load environment stage env_url = config.get("env_url", "/Isaac/Environments/Grid/default_environment.usd") env_path = env_url if env_url.startswith("omniverse://") else assets_root_path + env_url print(f"[SDG] Loading Stage {env_url}") omni.usd.get_context().open_stage(env_path) stage = omni.usd.get_context().get_stage() await omni.kit.app.get_app().next_update_async() # Initialize randomization rep.set_global_seed(42) rng = np.random.default_rng(42) # Configure replicator for manual triggering rep.orchestrator.set_capture_on_play(False) # Set DLSS to Quality mode for best SDG results carb.settings.get_settings().set("rtx/post/dlss/execMode", 2) # Clear previous semantic labels if config.get("clear_previous_semantics", True): for prim in stage.Traverse(): remove_all_labels(prim, include_descendants=True) # Create SDG scope for organizing all generated objects define_prim("/SDG", "Scope") # Spawn forklift at random pose forklift_path = "/SDG/Forklift" forklift_prim = define_prim(forklift_path) add_reference_to_stage(assets_root_path + config["forklift"]["url"], forklift_path) add_labels(forklift_prim, labels=[config["forklift"]["class"]], taxonomy="class") XformPrim( forklift_path, positions=(rng.uniform(-20, -2), rng.uniform(-1, 3), 0), orientations=euler_angles_to_quaternion([0, 0, rng.uniform(0, math.pi)]).numpy(), reset_xform_op_properties=True, ) # Spawn pallet in front of forklift with random offset forklift_tf = omni.usd.get_world_transform_matrix(forklift_prim) pallet_offset_tf = Gf.Matrix4d().SetTranslate(Gf.Vec3d(0, rng.uniform(-1.8, -1.2), 0)) pallet_pos = tuple((pallet_offset_tf * forklift_tf).ExtractTranslation()) forklift_quat = forklift_tf.ExtractRotationQuat() forklift_quat_xyzw = (forklift_quat.GetReal(), *forklift_quat.GetImaginary()) pallet_path = "/SDG/Pallet" pallet_prim = define_prim(pallet_path) add_reference_to_stage(assets_root_path + config["pallet"]["url"], pallet_path) add_labels(pallet_prim, labels=[config["pallet"]["class"]], taxonomy="class") XformPrim( pallet_path, positions=pallet_pos, orientations=forklift_quat_xyzw, reset_xform_op_properties=True, ) ``` -------------------------------- ### GettingStartedRobot Class API Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/extensions/isaacsim.examples.interactive/config/python_api.html Provides methods for robot-specific scene setup, physics step handling, and simulation state management for the Getting Started Robot example. ```APIDOC ## class GettingStartedRobot(BaseSample) ### Description Represents the Getting Started Robot sample, offering functionalities for scene setup, physics step execution, simulation state management, and cleanup. ### Methods - `__init__(self)`: Constructor for the GettingStartedRobot class. - `setup_scene(self)`: Configures the simulation scene for the robot. - `setup_post_load(self)`: Asynchronous method called after the scene is loaded. - `on_physics_step(self, step_size: float, context: object)`: Called on each physics step. Takes step size and context as arguments. - `setup_pre_reset(self)`: Asynchronous method called before resetting the simulation. - `setup_post_reset(self)`: Asynchronous method called after resetting the simulation. - `setup_post_clear(self)`: Asynchronous method called after clearing the scene. - `physics_cleanup(self)`: Cleans up physics-related resources. ``` -------------------------------- ### Initialize and Run SDG Pipeline Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_cosmos.html Sets up the simulation environment, loads assets, configures sensors, and runs the SDG pipeline for data capture. Ensure the camera prim and navigation target prim are valid before proceeding. ```python async def run_example_async( num_clips, num_frames_per_clip, capture_interval, start_delay=0.0, use_instance_id=True, segmentation_mapping=None, ): assets_root_path = await get_assets_root_path_async() stage_path = assets_root_path + STAGE_URL print(f"Opening stage: '{stage_path}'") omni.usd.get_context().open_stage(stage_path) stage = omni.usd.get_context().get_stage() # Enable script nodes carb.settings.get_settings().set_bool("/app/omni.graph.scriptnode/opt_in", True) # Disable capture on play on the new stage, data is captured manually using the step function rep.orchestrator.set_capture_on_play(False) # Set DLSS to Quality mode (2) for best SDG results (Options: 0 (Performance), 1 (Balanced), 2 (Quality), 3 (Auto) carb.settings.get_settings().set("rtx/post/dlss/execMode", 2) # Load carter nova asset with its navigation graph carter_url_path = assets_root_path + CARTER_NAV_ASSET_URL print(f"Loading carter nova asset: '{carter_url_path}' at prim path: '{CARTER_NAV_PATH}'") carter_nav_prim = add_reference_to_stage(usd_path=carter_url_path, path=CARTER_NAV_PATH) if not carter_nav_prim.GetAttribute("xformOp:translate"): UsdGeom.Xformable(carter_nav_prim).AddTranslateOp() carter_nav_prim.GetAttribute("xformOp:translate").Set(CARTER_NAV_POSITION) # Set the navigation target position carter_navigation_target_prim = stage.GetPrimAtPath(CARTER_NAV_TARGET_PATH) if not carter_navigation_target_prim.IsValid(): print(f"Carter navigation target prim not found at path: {CARTER_NAV_TARGET_PATH}, exiting") return if not carter_navigation_target_prim.GetAttribute("xformOp:translate"): UsdGeom.Xformable(carter_navigation_target_prim).AddTranslateOp() carter_navigation_target_prim.GetAttribute("xformOp:translate").Set(CARTER_NAV_TARGET_POSITION) # Use the carter nova front hawk camera for capturing data camera_prim = stage.GetPrimAtPath(CARTER_CAMERA_PATH) if not camera_prim.IsValid(): print(f"Camera prim not found at path: {CARTER_CAMERA_PATH}, exiting") return # tickRate=0 forces autotrigger so the sensor cameras stay in sync with rep.orchestrator.step_async # under multi-tick rendering. if camera_prim.HasAttribute("omni:sensor:tickRate"): camera_prim.GetAttribute("omni:sensor:tickRate").Set(0.0) # Advance the timeline with the start delay if provided if start_delay is not None and start_delay > 0: await advance_timeline_by_duration_async(start_delay) # Run the SDG pipeline await run_sdg_pipeline_async( camera_prim.GetPath(), num_clips, num_frames_per_clip, capture_interval, use_instance_id, segmentation_mapping, ) ``` -------------------------------- ### Get Entities Matching a Filter Source: https://docs.isaacsim.omniverse.nvidia.com/latest/ros2_tutorials/tutorial_ros2_simulation_control.html Retrieves entities from the simulation based on a regex pattern applied to their prim paths. Examples include filtering for paths containing 'camera', starting with '/World', or ending with 'mesh'. ```bash ros2 service call /get_entities simulation_interfaces/srv/GetEntities "{filters: {filter: 'camera'}}" ``` ```bash ros2 service call /get_entities simulation_interfaces/srv/GetEntities "{filters: {filter: '^/World'}}" ``` ```bash ros2 service call /get_entities simulation_interfaces/srv/GetEntities "{filters: {filter: 'mesh$'}}" ``` -------------------------------- ### setup_writer Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/extensions/isaacsim.replicator.writers/docs/index.html Initializes a writer instance and attaches the specified render product. This is a crucial step before data can be written. ```APIDOC ## setup_writer(_writer_config : dict_) ### Description Initialize writer and attach render product. ### Parameters * **config_data** (dict) - A dictionary containing the general configurations for the script. * **writer_config** (dict) - A dictionary containing writer-specific configurations. ### Returns Initialized DOPE writer instance. ``` -------------------------------- ### Async Example for Replicator Scene Setup and Rendering Source: https://docs.isaacsim.omniverse.nvidia.com/latest/replicator_tutorials/tutorial_replicator_isaac_snippets.html Sets up a new stage, configures Replicator, creates scene elements like lights and cameras, and defines render products. It demonstrates both custom writer and direct annotator access for data capture. ```python async def run_example_async(): # Create a new stage await omni.usd.get_context().new_stage_async() # Set global random seed for the replicator randomizer rep.set_global_seed(11) # Disable capture on play to capture data manually using step rep.orchestrator.set_capture_on_play(False) # Set DLSS to Quality mode (2) for best SDG results , options: 0 (Performance), 1 (Balanced), 2 (Quality), 3 (Auto) carb.settings.get_settings().set("rtx/post/dlss/execMode", 2) # Setup stage rep.functional.create.xform(name="World") rep.functional.create.dome_light(intensity=900, parent="/World", name="DomeLight") cube = rep.functional.create.cube(parent="/World", name="Cube", semantics={"class": "my_cube"}) # Register the graph-based cube color randomizer to trigger on every frame rep.randomizer.register(cube_color_randomizer) with rep.trigger.on_frame(): rep.randomizer.cube_color_randomizer() # Create cameras cam_top = rep.functional.create.camera(position=(0, 0, 5), look_at=(0, 0, 0), parent="/World", name="CamTop") cam_side = rep.functional.create.camera(position=(2, 2, 0), look_at=(0, 0, 0), parent="/World", name="CamSide") cam_persp = rep.functional.create.camera(position=(5, 5, 5), look_at=(0, 0, 0), parent="/World", name="CamPersp") # Create the render products rp_top = rep.create.render_product(cam_top, resolution=(320, 320), name="RpTop") rp_side = rep.create.render_product(cam_side, resolution=(640, 640), name="RpSide") rp_persp = rep.create.render_product(cam_persp, resolution=(1024, 1024), name="RpPersp") # Example of accessing the data through a custom writer writer = rep.WriterRegistry.get("MyWriter") writer.initialize(rgb=True) writer.attach([rp_top, rp_side, rp_persp]) # Example of accessing the data directly through annotators rgb_annotators = [] for rp in [rp_top, rp_side, rp_persp]: # Create a new rgb annotator for each render product rgb = rep.annotators.get("rgb") # Attach the annotator to the render product rgb.attach(rp) rgb_annotators.append(rgb) # Create annotator output directory output_dir_annot = os.path.join(os.getcwd(), "_out_mc_annot") print(f"Writing annotator data to {output_dir_annot}") os.makedirs(output_dir_annot, exist_ok=True) for i in range(NUM_FRAMES): print(f"Step {i}") # The step function triggers registered graph-based randomizers, collects data from annotators, # and invokes the write function of attached writers with the annotator data await rep.orchestrator.step_async(rt_subframes=32) for j, rgb_annot in enumerate(rgb_annotators): file_path = os.path.join(output_dir_annot, f"rp{j}_step_{i}.png") write_image(path=file_path, data=rgb_annot.get_data()) # Wait for the data to be written and release resources await rep.orchestrator.wait_until_complete_async() writer.detach() for annot in rgb_annotators: annot.detach() for rp in [rp_top, rp_side, rp_persp]: rp.destroy() asyncio.ensure_future(run_example_async()) ``` -------------------------------- ### Run Hello World Example on Linux Source: https://docs.isaacsim.omniverse.nvidia.com/latest/introduction/examples.html Execute the 'hello_world.py' example script using the provided Python shell script on Linux systems. Ensure you are in the Isaac Sim root directory. ```bash ./python.sh standalone_examples/api/isaacsim.simulation_app/hello_world.py ``` -------------------------------- ### Enable isaacsim.cortex.examples via Command Line Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/deprecated/isaacsim.cortex.examples/docs/index.html Enable the isaacsim.cortex.examples extension by providing it as an application argument in the terminal. ```bash APP_SCRIPT.(sh|bat) --enable isaacsim.cortex.examples ``` -------------------------------- ### Enable isaacsim.replicator.examples via CLI Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/extensions/isaacsim.replicator.examples/docs/index.html Enable the isaacsim.replicator.examples extension by passing it as an application argument from the terminal. ```bash APP_SCRIPT.(sh|bat) --enable isaacsim.replicator.examples ``` -------------------------------- ### GettingStartedExtension Class API Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/extensions/isaacsim.examples.interactive/config/python_api.html Manages the lifecycle of the Getting Started extension, including startup and shutdown. ```APIDOC ## class GettingStartedExtension(omni.ext.IExt) ### Description Manages the extension lifecycle for the Getting Started sample. ### Methods - `on_startup(self, ext_id: str)`: Called when the extension is starting up. Requires the extension ID. - `on_shutdown(self)`: Called when the extension is shutting down. ``` -------------------------------- ### Run Follow Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/cortex_tutorials/tutorial_cortex_2_decider_networks.html Execute the initial follow example script to launch the robot with a sphere at its end-effector. ```bash isaac_python follow_example_main.py ``` -------------------------------- ### Install Dependencies and Warm Up Cache Source: https://docs.isaacsim.omniverse.nvidia.com/latest/installation/install_faq.html Install Python dependencies and run example scripts to warm up the shader cache within the Isaac Sim container. This prepares the container for creating a cached image. ```bash $ ./python.sh -m pip install stable-baselines3 tensorboard $ ./python.sh standalone_examples/api/isaacsim.simulation_app/hello_world.py -v $ ./runheadless.sh -v --/app/quitAfter=1000 ``` -------------------------------- ### Install UR Description Package (Jazzy) Source: https://docs.isaacsim.omniverse.nvidia.com/latest/robot_setup_tutorials/tutorial_import_assemble_manipulator.html Installs the prebuilt UR description package for ROS 2 Jazzy and sources the ROS 2 setup script. Launch Isaac Sim from the same terminal. ```bash sudo apt install ros-jazzy-ur-description source /opt/ros/jazzy/setup.bash ./isaac-sim.sh ``` -------------------------------- ### Complete Isaac Sim Robot Control Example Source: https://docs.isaacsim.omniverse.nvidia.com/latest/core_api_tutorials/tutorial_core_hello_robot.html A full example demonstrating scene setup, robot articulation, joint index retrieval, and physics step callbacks for continuous robot control. ```python 1import carb 2import isaacsim.core.experimental.utils.stage as stage_utils 3import numpy as np 4from isaacsim.core.experimental.prims import Articulation 5from isaacsim.core.simulation_manager import SimulationManager 6from isaacsim.examples.base.base_sample_experimental import BaseSample 7from isaacsim.storage.native import get_assets_root_path 8 9 10class HelloWorld(BaseSample): 11 def __init__(self) -> None: 12 super().__init__() 13 self._physics_callback_id = None 14 15 def setup_scene(self): 16 # Add ground plane 17 ground_plane = stage_utils.add_reference_to_stage( 18 usd_path=get_assets_root_path() + "/Isaac/Environments/Grid/default_environment.usd", 19 path="/World/ground", 20 ) 21 22 # Add the Jetbot robot to the stage 23 assets_root_path = get_assets_root_path() 24 asset_path = assets_root_path + "/Isaac/Robots/NVIDIA/Jetbot/jetbot.usd" 25 stage_utils.add_reference_to_stage(usd_path=asset_path, path="/World/Fancy_Robot") 26 27 async def setup_post_load(self): 28 # Wrap the Jetbot with the Articulation class 29 self._jetbot = Articulation("/World/Fancy_Robot") 30 31 # -- Begin getting indices -- # 32 # Print available DOF names 33 print("Available DOFs:", self._jetbot.dof_names) 34 35 # Get indices for specific wheel joints 36 self._wheel_indices = self._jetbot.get_dof_indices(["left_wheel_joint", "right_wheel_joint"]).numpy() 37 print("Wheel indices:", self._wheel_indices) 38 # -- End of getting indices -- # 39 40 # Register physics callback 41 from isaacsim.core.simulation_manager.impl.isaac_events import IsaacEvents 42 43 self._physics_callback_id = SimulationManager.register_callback( 44 self.send_robot_actions, IsaacEvents.POST_PHYSICS_STEP 45 ) 46 47 def send_robot_actions(self, dt, context): 48 # -- Begin setting wheel velocity -- # 49 # Apply velocity targets to specific DOF indices 50 wheel_velocities = np.array([[10.0, 10.0]]) # Both wheels same speed = forward 51 self._jetbot.set_dof_velocity_targets(wheel_velocities, dof_indices=self._wheel_indices) 52 # -- End of setting wheel velocity -- # 53 54 def physics_cleanup(self): 55 if self._physics_callback_id is not None: 56 SimulationManager.deregister_callback(self._physics_callback_id) 57 self._physics_callback_id = None ``` -------------------------------- ### Start SimulationApp and Enable Extensions Source: https://docs.isaacsim.omniverse.nvidia.com/latest/python_scripting/manual_standalone_python.html Initializes the SimulationApp and enables specific UI extensions. Ensure `headless` is set appropriately for your use case. ```python from isaacsim import SimulationApp # Start the application simulation_app = SimulationApp({"headless": False}) # Get the utility to enable extensions from isaacsim.core.utils.extensions import enable_extension # Enable the layers and stage windows in the UI enable_extension("omni.kit.widget.stage") enable_extension("omni.kit.widget.layers") simulation_app.update() ``` -------------------------------- ### GettingStartedRobotExtension Class API Source: https://docs.isaacsim.omniverse.nvidia.com/latest/py/source/extensions/isaacsim.examples.interactive/config/python_api.html Manages the lifecycle of the Getting Started Robot extension, including startup and shutdown. ```APIDOC ## class GettingStartedRobotExtension(omni.ext.IExt) ### Description Manages the extension lifecycle for the Getting Started Robot sample. ### Methods - `on_startup(self, ext_id: str)`: Called when the extension is starting up. Requires the extension ID. - `on_shutdown(self)`: Called when the extension is shutting down. ```