### Run Follow-Target Example for Different Robots Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/api/isaacsim.robot.manipulators/rmpflow_supported_robots/README.md Examples of executing the script with specific robot names and their corresponding USD asset paths. ```bash python.sh supported_robot_follow_target_example.py --robot-name RS080N --usd-path "/Isaac/Robots/Kawasaki/RS080N/rs080n_onrobot_rg2.usd" ``` ```bash python.sh supported_robot_follow_target_example.py --robot-name UR16e --usd-path "/Isaac/Robots/UniversalRobots/ur16e/ur16e.usd" ``` ```bash python.sh supported_robot_follow_target_example.py --robot-name FestoCobot --usd-path "/Isaac/Robots/Festo/FestoCobot/festo_cobot.usd" ``` -------------------------------- ### Install Prerequisites on Ubuntu/Debian Source: https://github.com/isaac-sim/isaacsim/blob/main/tools/docker/README.md Install required system dependencies before running build scripts. ```bash sudo apt-get update sudo apt-get install -y rsync python3 docker.io ``` -------------------------------- ### Initialize SimulationApp Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/testing/notebooks/basic_notebook.ipynb Instantiate the SimulationApp class to start the simulation environment. ```python from isaacsim import SimulationApp # The most basic usage for creating a simulation app simulation_app = SimulationApp() ``` -------------------------------- ### Install build-essential on Linux Source: https://github.com/isaac-sim/isaacsim/blob/main/README.md Install essential build tools required for compiling applications on Ubuntu. ```bash sudo apt-get install build-essential ``` -------------------------------- ### Start Franka Robot Controllers Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Initiates the Franka controller manager, sets high collision thresholds, and starts the joint position controller, which synchronizes the belief with the physical robot. Also starts the gripper commander listener. ```bash source ~/catkin_ws/devel/setup.bash roslaunch cortex_control_franka franka_control_lula.launch ``` ```bash rosrun cortex_control_franka set_high_collision_thresholds ``` ```bash roslaunch cortex_control_franka joint_position_controller.launch ``` ```bash rosrun cortex_control_franka franka_gripper_command_relay.py ``` -------------------------------- ### Environment Setup and Object/Robot Instantiation Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.replicator.domain_randomization/docs/usage.rst Sets up the initial environment, adds a dynamic sphere, and references a robot USD file. It then clones environments and creates views for objects and robots. ```python define_prim("/World/envs/env_0") # set up the first environment DynamicSphere(prim_path="/World/envs/env_0/object", radius=0.1, position=np.array([0.75, 0.0, 0.2])) add_reference_to_stage( usd_path=get_assets_root_path()+ "/Isaac/Robots/Franka/franka.usd", prim_path="/World/envs/env_0/franka", ) # clone environments num_envs = 4 prim_paths = cloner.generate_paths("/World/envs/env", num_envs) env_pos = cloner.clone(source_prim_path="/World/envs/env_0", prim_paths=prim_paths) # creates the views and set up world object_view = RigidPrim(prim_paths_expr="/World/envs/*/object", name="object_view") franka_view = Articulation(prim_paths_expr="/World/envs/*/franka", name="franka_view") world.scene.add(object_view) world.scene.add(franka_view) world.reset() num_dof = franka_view.num_dof ``` -------------------------------- ### Configure Non-Default Installation Paths Source: https://github.com/isaac-sim/isaacsim/blob/main/docs/readme/windows_developer_configuration.md Specify custom installation directories for Visual Studio and the Windows SDK when they are not in default locations. ```toml [repo_build.msbuild] vs_path = "D:\\CustomPath\\Visual Studio\\2022\\Community" winsdk_path = "D:\\CustomPath\\Windows Kits\\10\\bin\\10.0.19041.0" ``` -------------------------------- ### Setup World and Ground Plane Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/notebooks/hello_world.ipynb Initializes the simulation world and adds a default ground plane. Requires a render call to update the GUI. ```python from isaacsim.core.api import World from isaacsim.core.api.objects import DynamicCuboid import numpy as np world = World(stage_units_in_meters=1.0) world.scene.add_default_ground_plane() # A render/ step or an update call is needed to reflect the changes to the opened USD in Isaac Sim GUI # Note: avoid pressing play/ pause or stop in the GUI in this workflow. world.render() ``` -------------------------------- ### Block stacking environment layout Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Example hierarchy for a block stacking environment containing both belief and sim prims. ```text /cortex /belief /robot # Franka USD with cortex:robot_type of 'franka' /objects /red_block # cortex:is_obstacle = True /yellow_block # cortex:is_obstacle = True /green_block # cortex:is_obstacle = True /blue_block # cortex:is_obstacle = True /sim /robot # Franka USD with cortex:robot_type of 'franka' /objects /red_block /yellow_block /green_block /blue_block ``` -------------------------------- ### Cortex USD path naming examples Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Standard file path naming conventions for Cortex USD environment files. ```text Isaac/Samples/Cortex/Franka/BlocksWorld/cortex_franka_belief.usd Isaac/Samples/Cortex/Franka/BlocksWorld/cortex_franka_blocks_belief_sim.usd Isaac/Samples/Cortex/UR10/Basic/cortex_ur10_basic_belief.usd Isaac/Samples/Cortex/UR10/Basic/cortex_ur10_basic_belief_sim.usd ``` -------------------------------- ### Install GCC/G++ 11 on Linux Source: https://github.com/isaac-sim/isaacsim/blob/main/README.md Configure the system to use GCC/G++ 11, which is the required compiler version. ```bash sudo apt-get install gcc-11 g++-11 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 200 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 200 ``` -------------------------------- ### Start Cortex Loop Runner Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Launches the Cortex loop runner with the Blocks World USD environment and enables ROS integration. Ensure you are in the standalone_examples/cortex directory. ```bash cd standalone_examples/cortex ./cortex launch \ --usd_env=Isaac/Samples/Cortex/Franka/BlocksWorld/cortex_franka_blocks_belief.usd \ --enable_ros ``` -------------------------------- ### Launch Cortex with ROS Integration Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Commands to start the loop runner with ROS enabled and the simulated controller for hardware-in-the-loop development. ```bash cd standalone_examples/cortex ./cortex launch \ --usd_env=Isaac/Samples/Cortex/Franka/BlocksWorld/cortex_franka_blocks_belief_sim.usd \ --enable_ros ``` ```bash cd standalone_examples/cortex ./cortex activate build_block_tower.py ``` ```bash rosrun cortex_control sim_controller ``` -------------------------------- ### Initialize Isaac Sim and Set Up World Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.replicator.domain_randomization/docs/usage.rst Initializes the SimulationApp in headless mode and sets up the physics world with a ground plane. This is a common setup for physics-based simulations. ```python from isaacsim import SimulationApp simulation_app = SimulationApp({"headless": False}) import numpy as np from isaacsim.core.api import World from isaacsim.core.prims import Articulation, RigidPrim from isaacsim.core.utils.prims import get_prim_at_path, define_prim from isaacsim.core.utils.stage import get_current_stage, add_reference_to_stage from isaacsim.storage.native import get_assets_root_path from isaacsim.core.api.objects import DynamicSphere from isaacsim.core.cloner import GridCloner # create the world world = World(stage_units_in_meters=1.0, physics_prim_path="/physicsScene", backend="numpy") world.scene.add_default_ground_plane() # set up grid cloner cloner = GridCloner(spacing=1.5) cloner.define_base_env("/World/envs") ``` -------------------------------- ### Method Naming with Verbs Source: https://github.com/isaac-sim/isaacsim/blob/main/docs/overview/guidelines.rst Method names must start with a verb to clearly indicate the action performed. ```cpp myVector.getLength(); myObject.applyForce(x, y, z); myObject.isDynamic(); texture.getFormat(); ``` -------------------------------- ### UI Utils - Shared UI Elements Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.gui.components/docs/api.rst Utilities for shared UI elements, including header setup. ```APIDOC ## setup_ui_headers ### Description Sets up headers for the UI. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Python function) ### Request Example ```python from isaacsim.gui.components import ui_utils ui_utils.setup_ui_headers() ``` ### Response N/A (Python function) ``` -------------------------------- ### Domain Randomization Setup Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.replicator.domain_randomization/docs/usage.rst Registers simulation contexts and views with the domain randomization module. This is a prerequisite for applying randomization operations. ```python # set up randomization with isaacsim.replicator, imported as dr import isaacsim.replicator.domain_randomization as dr import omni.replicator.core as rep dr.physics_view.register_simulation_context(world) dr.physics_view.register_rigid_prim_view(object_view) dr.physics_view.register_articulation_view(franka_view) ``` -------------------------------- ### GET /isaacsim/core/version Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.core.version/docs/api.rst Retrieves versioning information for the Isaac Sim core module. ```APIDOC ## GET /isaacsim/core/version ### Description Retrieves the current version information for the isaacsim.core.version module. ### Method GET ### Endpoint /isaacsim/core/version ``` -------------------------------- ### Launch Cortex Loop Runner (Belief Only) Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Commands to start the main loop runner without ROS integration using the provided USD environment. ```bash cd standalone_examples/cortex ./cortex launch --usd_env=Isaac/Samples/Cortex/Franka/BlocksWorld/cortex_franka_blocks_belief.usd # The `cortex` script is an alias to the `cortex_main.py` loop runner. Alternatively, from the base # dirctory of Isaac Sim you can execute the loop runner directly using: ./python.sh exts/isaacsim.cortex.framework/omni/isaac/cortex/cortex_main.py \ --usd_env=Isaac/Samples/Cortex/Franka/BlocksWorld/cortex_franka_blocks_belief.usd ``` -------------------------------- ### Perform Basic Build Source: https://github.com/isaac-sim/isaacsim/blob/main/tools/docker/README.md Run the full build sequence and create the image with default tags. ```bash # Prepare build environment (includes full build) ./tools/docker/prep_docker_build.sh --build # Build Docker image with default tag ./tools/docker/build_docker.sh ``` -------------------------------- ### Build with Custom Tag Source: https://github.com/isaac-sim/isaacsim/blob/main/tools/docker/README.md Prepare the environment and build the image using a specific tag. ```bash # Prepare build environment ./tools/docker/prep_docker_build.sh --build # Build with custom tag ./tools/docker/build_docker.sh --tag my-isaac-sim:v1.0 ``` -------------------------------- ### Setting and Getting Masses with Warp Arrays Source: https://github.com/isaac-sim/isaacsim/blob/main/docs/overview/experimental.rst Demonstrates how to set and get masses for RigidPrim instances using Warp arrays, with support for NumPy arrays and Python lists as input. ```python >>> rb.set_masses(wp.array([5.0, 5.0])) # expected data (Warp array) >>> rb.set_masses(np.array([5.0, 5.0])) # <-- this is fine (NumPy array) >>> rb.set_masses([5.0, 5.0]) # <-- this is fine (Python list) >>> rb.set_masses(5.0) # <-- this is fine (Python basic type) >>> >>> output = rb.get_masses() # 'output' is a Warp array ``` -------------------------------- ### Importing a URDF file with Python commands Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.asset.importer.urdf/docs/api.rst Demonstrates configuring import settings, loading a URDF file, and setting up a basic physics scene with gravity, a ground plane, and lighting. ```python import omni.kit.commands from pxr import UsdLux, Sdf, Gf, UsdPhysics, PhysicsSchemaTools # setting up import configuration: status, import_config = omni.kit.commands.execute("URDFCreateImportConfig") import_config.merge_fixed_joints = False import_config.convex_decomp = False import_config.import_inertia_tensor = True import_config.fix_base = False import_config.collision_from_visuals = False # Get path to extension data: ext_manager = omni.kit.app.get_app().get_extension_manager() ext_id = ext_manager.get_enabled_extension_id("isaacsim.asset.importer.urdf") extension_path = ext_manager.get_extension_path(ext_id) # import URDF omni.kit.commands.execute( "URDFParseAndImportFile", urdf_path=extension_path + "/data/urdf/robots/carter/urdf/carter.urdf", import_config=import_config, ) # get stage handle stage = omni.usd.get_context().get_stage() # enable physics scene = UsdPhysics.Scene.Define(stage, Sdf.Path("/physicsScene")) # set gravity scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0)) scene.CreateGravityMagnitudeAttr().Set(9.81) # add ground plane PhysicsSchemaTools.addGroundPlane(stage, "/World/groundPlane", "Z", 1500, Gf.Vec3f(0, 0, -50), Gf.Vec3f(0.5)) # add lighting distantLight = UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight")) distantLight.CreateIntensityAttr(500) ``` -------------------------------- ### Get Entity State Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Gets the pose, twist, and acceleration of a specific entity relative to a given reference frame. Supports world frames only. Returns RESULT_OK on success, RESULT_NOT_FOUND if the entity does not exist. ```bash ros2 service call /get_entity_state simulation_interfaces/srv/GetEntityState "{entity: '/World/robot'}" ``` -------------------------------- ### Enable Windows C++ Build Process Source: https://github.com/isaac-sim/isaacsim/blob/main/docs/readme/windows_developer_configuration.md Configure the build platform and toolchain linking in the project's repo.toml file. ```toml [repo_build.build] "platform:windows-x86_64".enabled = true ``` ```toml [repo_build.msbuild] link_host_toolchain = true ``` -------------------------------- ### Prepare Docker Build Environment Source: https://github.com/isaac-sim/isaacsim/blob/main/tools/docker/README.md Execute the preparation script to set up the build context. ```bash ./tools/docker/prep_docker_build.sh [OPTIONS] ``` -------------------------------- ### Configure Camera and Visual Objects Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/testing/notebooks/test_syntheticdata_notebook.ipynb Sets up a camera with various synthetic data output frames and spawns a visual cuboid in the scene. ```python from isaacsim.sensors.camera import Camera from isaacsim.core.api.objects import VisualCuboid, DynamicCuboid from omni.kit.viewport.utility import get_active_viewport viewport_api = get_active_viewport() render_product_path = viewport_api.get_render_product_path() camera = Camera( prim_path="/World/camera", position=np.array([0.0, 0.0, 25.0]), resolution=(1280, 720), render_product_path = render_product_path ) simulation_app.update() camera.initialize() simulation_app.update() camera.add_distance_to_image_plane_to_frame() camera.add_bounding_box_2d_tight_to_frame() camera.add_bounding_box_2d_loose_to_frame() camera.add_instance_segmentation_to_frame() camera.add_semantic_segmentation_to_frame() camera.add_bounding_box_3d_to_frame() simulation_app.update() VisualCuboid( prim_path="/new_cube_1", name="visual_cube", position=np.array([0, 0, 0.5]), scale=np.array([1, 1, 1]), color=np.array([255, 255, 255]), ) ``` -------------------------------- ### Get All Entities Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Retrieves all entities in the simulation. The filter parameter accepts POSIX Extended regular expressions. ```bash ros2 service call /get_entities simulation_interfaces/srv/GetEntities "{filters: {filter: ''}}" ``` -------------------------------- ### Initialize and Synchronize Simulation with ROS2 Source: https://context7.com/isaac-sim/isaacsim/llms.txt Sets up a simulation context and runs a loop synchronized with an external ROS2 node. ```python simulation_context = SimulationContext(physics_dt=1.0/60.0, rendering_dt=1.0/60.0) simulation_context.initialize_physics() simulation_context.play() # Run synchronized simulation and ROS2 for frame in range(60): simulation_context.step(render=True) rclpy.spin_once(node, timeout_sec=0.0) time.sleep(0.01) rclpy.shutdown() simulation_context.stop() simulation_app.close() ``` -------------------------------- ### Run Isaac Sim Executable Source: https://github.com/isaac-sim/isaacsim/blob/main/README.md Navigate to the release directory and launch the Isaac Sim application. ```bash cd _build/linux-x86_64/release ./isaac-sim.sh ``` ```bash cd _build/linux-aarch64/release ./isaac-sim.sh ``` ```powershell cd _build/windows-x86_64/release isaac-sim.bat ``` -------------------------------- ### URDF Import Commands and Configuration Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.asset.importer.urdf/docs/api.rst This snippet demonstrates how to configure and execute URDF import commands, including setting up import configurations, importing a URDF file, and enabling physics with lighting. ```APIDOC ## URDF Import Commands ### Description This section provides commands and a sample script for importing URDF files using the `isaacsim.asset.importer.urdf` extension. It covers setting up import configurations and executing the import process. ### Method `omni.kit.commands.execute` ### Endpoints - `URDFCreateImportConfig` - `URDFParseAndImportFile` ### Parameters #### URDFCreateImportConfig This command creates a default import configuration object. #### URDFParseAndImportFile - **urdf_path** (string) - Required - The absolute path to the URDF file to import. - **import_config** (object) - Required - An instance of `ImportConfig` with desired import settings. ### Request Body (for URDFParseAndImportFile) #### ImportConfig Object Fields - **merge_fixed_joints** (boolean) - Optional - If true, merges fixed joints. - **convex_decomp** (boolean) - Optional - If true, enables convex decomposition for collision shapes. - **import_inertia_tensor** (boolean) - Optional - If true, imports inertia tensor data. - **fix_base** (boolean) - Optional - If true, fixes the base of the robot. - **collision_from_visuals** (boolean) - Optional - If true, generates collision shapes from visual geometry. ### Request Example (Python) ```python import omni.kit.commands from pxr import UsdLux, Sdf, Gf, UsdPhysics, PhysicsSchemaTools # setting up import configuration: status, import_config = omni.kit.commands.execute("URDFCreateImportConfig") import_config.merge_fixed_joints = False import_config.convex_decomp = False import_config.import_inertia_tensor = True import_config.fix_base = False import_config.collision_from_visuals = False # Get path to extension data: ext_manager = omni.kit.app.get_app().get_extension_manager() ext_id = ext_manager.get_enabled_extension_id("isaacsim.asset.importer.urdf") extension_path = ext_manager.get_extension_path(ext_id) # import URDF omni.kit.commands.execute( "URDFParseAndImportFile", urdf_path=extension_path + "/data/urdf/robots/carter/urdf/carter.urdf", import_config=import_config, ) # get stage handle stage = omni.usd.get_context().get_stage() # enable physics scene = UsdPhysics.Scene.Define(stage, Sdf.Path("/physicsScene")) # set gravity scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0)) scene.CreateGravityMagnitudeAttr().Set(9.81) # add ground plane PhysicsSchemaTools.addGroundPlane(stage, "/World/groundPlane", "Z", 1500, Gf.Vec3f(0, 0, -50), Gf.Vec3f(0.5)) # add lighting distantLight = UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight")) distantLight.CreateIntensityAttr(500) ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the command execution was successful. - **result** (object) - The result of the command, which could be an import configuration object or other relevant data. #### Response Example (for URDFCreateImportConfig) ```json { "status": true, "result": { "merge_fixed_joints": false, "convex_decomp": false, "import_inertia_tensor": true, "fix_base": false, "collision_from_visuals": false } } ``` ``` -------------------------------- ### GetEntityState Service Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Gets the pose, twist, and acceleration of a specific entity relative to a given reference frame (currently only world frames are supported). ```APIDOC ## GET /get_entity_state ### Description Gets the pose, twist, and acceleration of a specific entity relative to a given reference frame. ### Method ROS2 Service Call ### Endpoint /get_entity_state ### Parameters #### Query Parameters - **entity** (string) - Required - The prim path of the entity. ### Request Example ```bash ros2 service call /get_entity_state simulation_interfaces/srv/GetEntityState "{entity: '/World/robot'}" ``` ### Response #### Success Response (200) - **state** (object) - The state of the entity. - **pose** (object) - The pose of the entity. - **position** (object) - The position of the entity. - **x**, **y**, **z** (float) - Coordinates. - **orientation** (object) - The orientation of the entity. - **x**, **y**, **z**, **w** (float) - Quaternion components. - **twist** (object) - The twist (linear and angular velocities) of the entity. - **linear** (object) - Linear velocity. - **x**, **y**, **z** (float) - Components. - **angular** (object) - Angular velocity. - **x**, **y**, **z** (float) - Components. - **acceleration** (object) - The acceleration of the entity (always zero). - **linear** (object) - Linear acceleration. - **x**, **y**, **z** (float) - Components. - **angular** (object) - Angular acceleration. - **x**, **y**, **z** (float) - Components. #### Response Example ```json { "state": { "pose": { "position": {"x": 0.0, "y": 0.0, "z": 0.0}, "orientation": {"x": 0.0, "y": 0.0, "z": 0.0, "w": 1.0} }, "twist": { "linear": {"x": 0.0, "y": 0.0, "z": 0.0}, "angular": {"x": 0.0, "y": 0.0, "z": 0.0} }, "acceleration": { "linear": {"x": 0.0, "y": 0.0, "z": 0.0}, "angular": {"x": 0.0, "y": 0.0, "z": 0.0} } } } ``` ``` -------------------------------- ### Get Entity Information Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Provides detailed information about a specific entity, such as its type and properties. Returns EntityInfo if the entity exists, otherwise RESULT_OPERATION_FAILED. ```bash ros2 service call /get_entity_info simulation_interfaces/srv/GetEntityInfo "{entity: '/World/robot'}" ``` -------------------------------- ### Initialize Isaac Sim Application Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/testing/notebooks/test_syntheticdata_notebook.ipynb Initializes the simulation environment in headless mode and creates a new USD stage. ```python import sys import numpy as np from isaacsim import SimulationApp simulation_app = SimulationApp(launch_config={"headless": True}) import omni simulation_app.update() omni.usd.get_context().new_stage() simulation_app.update() ``` -------------------------------- ### Create Simulation Context and Set Camera View Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/notebooks/scene_generation.ipynb Establishes a simulation world context and configures the camera's initial position and target. A simulation step is performed to ensure proper initialization. ```python from isaacsim.core.api import World from isaacsim.core.utils.viewports import set_camera_view import numpy as np simulation_world = World(stage_units_in_meters=1.0) set_camera_view(eye=np.array([-0.9025, 2.1035, 1.0222]), target=np.array([0.6039, 0.30, 0.0950])) # Step our simulation to ensure everything initialized simulation_world.step() ``` -------------------------------- ### Doxygen Comment for Public API (C++) Source: https://github.com/isaac-sim/isaacsim/blob/main/docs/overview/guidelines.rst Example of Doxygen-formatted comments for documenting public functions and variables. Use '@param' for parameters and '@returns' for return values. ```cpp /** * Tests whether this bounding box intersects the specified bounding box (see \ref BoundingBox class). * * You would add any specific details that may be needed here. This is * only necessary if there is complexity to the user of the function. * * @param box The bounding box to test intersection with. * @returns true if the specified bounding box intersects this bounding box, false otherwise. */ bool intersects(const BoundingBox& box) const; ``` -------------------------------- ### Initialize SimulationApp Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/notebooks/hello_world.ipynb Initializes the Isaac Sim application instance. ```python from isaacsim import SimulationApp # Set the path below to your desired nucleus server # Make sure you installed a local nucleus server before this simulation_app = SimulationApp() ``` -------------------------------- ### Filter Entities by Path Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Retrieves entities based on partial or full path matching using regular expressions. For example, to find entities containing 'camera' in their path. ```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$'}}" ``` -------------------------------- ### Get Current World Information Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Retrieve information about the currently loaded world, including its URI and name, using the GetCurrentWorld service. Returns 'NO_WORLD_LOADED' if no world is active. ```bash ros2 service call /get_current_world simulation_interfaces/srv/GetCurrentWorld ``` -------------------------------- ### Clone Isaac Sim Repository Source: https://github.com/isaac-sim/isaacsim/blob/main/README.md Download the repository and initialize Git LFS for large file management. ```bash git clone https://github.com/isaac-sim/IsaacSim.git isaacsim cd isaacsim git lfs install git lfs pull ``` -------------------------------- ### Interact with OmniGraph Attributes Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/testing/notebooks/test_ogn_notebook.ipynb Shows how to get and set attribute values on OmniGraph nodes and trigger simulation updates. Use this to dynamically control graph behavior during runtime. ```python input_attr = og.Controller.attribute("inputs:value", str_node) output_attr = og.Controller.attribute("outputs:output", test_node) og.DataView.set(input_attr, "Hello") simulation_app.update() value = og.DataView.get(output_attr) print(value) if value != "Hello": raise ValueError("Output does not equal Hello") simulation_app.update() og.DataView.set(input_attr, "Goodbye") simulation_app.update() value = og.DataView.get(output_attr) print(value) if value != "Goodbye": raise ValueError("Output does not equal Goodbye") simulation_app.update() ``` -------------------------------- ### Control Robot Joints with Articulation Source: https://context7.com/isaac-sim/isaacsim/llms.txt Demonstrates how to load a robot, initialize its articulation, control specific joints, and read joint states. Requires setting up the simulation app and physics context. ```python import numpy as np from isaacsim import SimulationApp simulation_app = SimulationApp({"headless": False}) from isaacsim.core.api import SimulationContext from isaacsim.core.prims import Articulation from isaacsim.core.utils.stage import add_reference_to_stage from isaacsim.storage.native import get_assets_root_path # Load Franka robot assets_root_path = get_assets_root_path() asset_path = assets_root_path + "/Isaac/Robots/FrankaRobotics/FrankaPanda/franka.usd" add_reference_to_stage(usd_path=asset_path, prim_path="/Franka") simulation_app.update() simulation_context = SimulationContext() simulation_context.initialize_physics() # Initialize articulation robot = Articulation("/Franka") robot.initialize() # Get joint information print(f"DOF count: {robot.num_dof}") print(f"Body names: {robot.body_names}") # Get specific joint index joint_idx = robot.get_dof_index("panda_joint2") simulation_context.play() # Control robot joints for i in range(500): # Set target position for specific joint robot.set_joint_positions([[-1.0]], joint_indices=[joint_idx]) simulation_context.step(render=True) # Read joint state positions = robot.get_joint_positions() velocities = robot.get_joint_velocities() print(f"Final positions: {positions}") simulation_context.stop() simulation_app.close() ``` -------------------------------- ### Get States for Multiple Entities Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Fetches the states (pose, twist, acceleration) of multiple entities. Filters entities first using regex pattern matching. More efficient than multiple GetEntityState calls. ```bash ros2 service call /get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: ''}}" ``` ```bash ros2 service call /get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: 'robot'}}" ``` ```bash ros2 service call /get_entities_states simulation_interfaces/srv/GetEntitiesStates "{filters: {filter: '^/World'}}" ``` -------------------------------- ### Launch Isaac Sim Application Source: https://context7.com/isaac-sim/isaacsim/llms.txt Instantiate the SimulationApp class to initialize the Omniverse Toolkit runtime. This must be performed before importing other Omniverse or USD modules. ```python from isaacsim import SimulationApp # Configure and launch simulation config = { "headless": False, # Set True for no GUI "width": 1280, # Viewport width "height": 720, # Viewport height "renderer": "RaytracedLighting", # Or "PathTracing" "physics_gpu": 0, # GPU for physics "anti_aliasing": 3, # 0=Off, 1=TAA, 2=FXAA, 3=DLSS } simulation_app = SimulationApp(config) # Now import other Isaac Sim modules from isaacsim.core.api import World # Main simulation loop while simulation_app.is_running(): simulation_app.update() simulation_app.close() ``` -------------------------------- ### Get Current Simulation State using ROS 2 Service Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Retrieves the current global state of the simulation (stopped, playing, paused, or quitting). Use this to query the state before performing operations. ```bash ros2 service call /get_simulation_state simulation_interfaces/srv/GetSimulationState ``` -------------------------------- ### Send SimulateSteps Action Goal with Feedback Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Send a goal to the SimulateSteps action and enable feedback to monitor progress. The action can be canceled during execution. ```bash ros2 action send_goal /simulate_steps simulation_interfaces/action/SimulateSteps "{steps: 20}" --feedback ``` -------------------------------- ### Initialize a Wheeled Robot Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.robot.wheeled_robots/docs/usage.rst Wraps an existing articulation prim on the stage into a WheeledRobot interface class. ```python # Assuming a stage context containing a Jetbot at /World/Jetbot from isaacsim.robot.wheeled_robots.robots import WheeledRobot jetbot_prim_path = "/World/Jetbot" #wrap the articulation in the interface class jetbot = WheeledRobot(prim_path=jetbot_prim_path, name="Joan", wheel_dof_names=["left_wheel_joint", "right_wheel_joint"] ) ``` -------------------------------- ### Initialize Headless Isaac Sim Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/notebooks/scene_generation.ipynb This code initializes the SimulationApp in headless mode. Ensure the path to your nucleus server is correctly set if applicable. This operation may take some time. ```python from isaacsim import SimulationApp # Set the path below to your desired nucleus server simulation_app = SimulationApp() print("Hi") ``` -------------------------------- ### Step Simulation by 10 Frames Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Use the StepSimulation service to advance the simulation by 10 frames. The simulation will automatically return to a paused state after completion. ```bash ros2 service call /step_simulation simulation_interfaces/srv/StepSimulation "{steps: 10}" ``` -------------------------------- ### Step Simulation by 100 Frames Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Use the StepSimulation service to advance the simulation by 100 frames. This service call blocks until all steps are completed. ```bash ros2 service call /step_simulation simulation_interfaces/srv/StepSimulation "{steps: 100}" ``` -------------------------------- ### Configure Domain Randomization for Training Source: https://context7.com/isaac-sim/isaacsim/llms.txt Sets up a multi-environment simulation with cloned assets and registers views for domain randomization. Requires the numpy backend for physics. ```python import numpy as np from isaacsim import SimulationApp simulation_app = SimulationApp({"headless": False}) from isaacsim.core.api import World from isaacsim.core.api.objects import DynamicSphere from isaacsim.core.cloner import GridCloner from isaacsim.core.prims import Articulation, RigidPrim from isaacsim.core.utils.prims import define_prim from isaacsim.core.utils.stage import add_reference_to_stage from isaacsim.storage.native import get_assets_root_path import isaacsim.replicator.domain_randomization as dr import omni.replicator.core as rep # Create world with numpy backend world = World(stage_units_in_meters=1.0, physics_prim_path="/physicsScene", backend="numpy") assets_root_path = get_assets_root_path() add_reference_to_stage(usd_path=assets_root_path + "/Isaac/Environments/Grid/default_environment.usd", prim_path="/World/defaultGroundPlane") # Setup cloner cloner = GridCloner(spacing=1.5) cloner.define_base_env("/World/envs") define_prim("/World/envs/env_0") # Create base environment with robot and object DynamicSphere(prim_path="/World/envs/env_0/object", radius=0.1, position=np.array([0.75, 0.0, 0.2])) add_reference_to_stage( usd_path=assets_root_path + "/Isaac/Robots/FrankaRobotics/FrankaPanda/franka.usd", prim_path="/World/envs/env_0/franka", ) # Clone environments num_envs = 4 prim_paths = cloner.generate_paths("/World/envs/env", num_envs) cloner.clone(source_prim_path="/World/envs/env_0", prim_paths=prim_paths) # Create views object_view = RigidPrim(prim_paths_expr="/World/envs/*/object", name="object_view") franka_view = Articulation("/World/envs/*/franka", name="franka_view") world.scene.add(object_view) world.scene.add(franka_view) world.reset() num_dof = franka_view.num_dof # Register views with domain randomization dr.physics_view.register_simulation_context(world) dr.physics_view.register_rigid_prim_view(object_view) dr.physics_view.register_articulation_view(franka_view) ``` -------------------------------- ### Display Supported Robots and RMPflow Configuration Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/api/isaacsim.robot.manipulators/rmpflow_supported_robots/README.md The output shows the list of supported robots and the parameters used to initialize the RmpFlow class when running with default arguments. ```text Names of supported robots with provided RMPflow config ['Franka', 'UR3', 'UR3e', 'UR5', 'UR5e', 'UR10', 'UR10e', 'UR16e', 'Rizon4', 'Cobotta_Pro_900', 'Cobotta_Pro_1300', 'RS007L', 'RS007N', 'RS013N', 'RS025N', 'RS080N', 'FestoCobot'] Successfully referenced RMPflow config for Cobotta_Pro_900. Using the following parameters to initialize RmpFlow class: { 'end_effector_frame_name': 'gripper_center', 'ignore_robot_state_updates': False, 'maximum_substep_size': 0.00334, 'rmpflow_config_path': '/path/to/omni_isaac_sim/_build/linux-x86_64/release/exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/./Denso/cobotta_pro_900/rmpflow/cobotta_rmpflow_common.yaml', 'robot_description_path': '/path/to/omni_isaac_sim/_build/linux-x86_64/release/exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/./Denso/cobotta_pro_900/rmpflow/robot_descriptor.yaml', 'urdf_path': '/path/to/omni_isaac_sim/_build/linux-x86_64/release/exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/./Denso/cobotta_pro_900/rmpflow/../cobotta_pro_900_gripper_frame.urdf' } ``` -------------------------------- ### Build Isaac Sim Source: https://github.com/isaac-sim/isaacsim/blob/main/README.md Execute the build script for the respective operating system. ```bash ./build.sh ``` ```powershell build.bat ``` -------------------------------- ### Build Docker Image Source: https://github.com/isaac-sim/isaacsim/blob/main/tools/docker/README.md Execute the build script to create the final Docker image. ```bash ./tools/docker/build_docker.sh [OPTIONS] ``` -------------------------------- ### Capture Camera Data and Project 3D Points Source: https://context7.com/isaac-sim/isaacsim/llms.txt Shows how to set up a camera sensor, add objects to the scene, capture RGB frames, and project 3D world points to 2D image coordinates. Requires matplotlib for saving images. ```python import numpy as np import matplotlib.pyplot as plt from isaacsim import SimulationApp simulation_app = SimulationApp({"headless": False}) import isaacsim.core.utils.numpy.rotations as rot_utils from isaacsim.core.api import World from isaacsim.core.api.objects import DynamicCuboid from isaacsim.sensors.camera import Camera my_world = World(stage_units_in_meters=1.0) # Add objects to scene cube = my_world.scene.add( DynamicCuboid( prim_path="/World/cube", name="cube", position=np.array([2.0, 0, 1.0]), size=0.5, color=np.array([255, 0, 0]), ) ) # Create camera sensor camera = Camera( prim_path="/World/camera", position=np.array([0.0, 0.0, 5.0]), frequency=20, resolution=(512, 512), orientation=rot_utils.euler_angles_to_quats(np.array([0, 90, 0]), degrees=True), ) my_world.scene.add_default_ground_plane() my_world.reset() camera.initialize() # Enable motion vectors camera.add_motion_vectors_to_frame() # Capture loop for i in range(100): my_world.step(render=True) if i % 20 == 0: # Get camera data frame = camera.get_current_frame() rgba = camera.get_rgba() # Project 3D points to 2D image coordinates cube_pos = cube.get_world_pose()[0] points_2d = camera.get_image_coords_from_world_points(np.array([cube_pos])) # Save image plt.imshow(rgba[:, :, :3]) plt.savefig(f"camera_frame_{i:03d}.png") print(f"Frame {i}: Cube at image coords {points_2d}") simulation_app.close() ``` -------------------------------- ### Clone Environments with GridCloner Source: https://context7.com/isaac-sim/isaacsim/llms.txt Illustrates how to use GridCloner to create multiple instances of a robot in a scene with specified spacing and offsets. It also shows how to create a batched articulation view for the cloned robots. ```python import numpy as np from isaacsim import SimulationApp simulation_app = SimulationApp({"headless": False}) from isaacsim.core.api import World from isaacsim.core.cloner import GridCloner from isaacsim.core.prims import Articulation from isaacsim.core.utils.stage import add_reference_to_stage from isaacsim.storage.native import get_assets_root_path my_world = World(stage_units_in_meters=1.0) my_world.scene.add_default_ground_plane() assets_root_path = get_assets_root_path() # Create initial robot asset_path = assets_root_path + "/Isaac/Robots/IsaacSim/Ant/ant.usd" add_reference_to_stage(usd_path=asset_path, prim_path="/World/Ants/Ant_0") # Create GridCloner with 2m spacing cloner = GridCloner(spacing=2) # Generate paths for 4 clones num_envs = 4 target_paths = cloner.generate_paths("/World/Ants/Ant", num_envs) # Clone with position offsets (lift all ants 1m up) position_offsets = np.array([[0, 0, 1]] * num_envs) cloner.clone( source_prim_path="/World/Ants/Ant_0", prim_paths=target_paths, position_offsets=position_offsets, replicate_physics=True, base_env_path="/World/Ants", ) # Create batched articulation view for all ants # Uses regex to match all ant torsos ants = Articulation("/World/Ants/.*/torso", name="ants_view") my_world.scene.add(ants) my_world.reset() ``` -------------------------------- ### Perform Quick Rebuild Source: https://github.com/isaac-sim/isaacsim/blob/main/tools/docker/README.md Skip deduplication to speed up the build process during development. ```bash # If you've already built once and want to rebuild quickly ./tools/docker/prep_docker_build.sh --skip-dedupe # Build the image ./tools/docker/build_docker.sh ``` -------------------------------- ### Activate Robot Behaviors Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.cortex.framework/docs/README.md Executes predefined behaviors for the physical robot, such as opening/closing the gripper or sending the robot to its home position. Ensure you are in the standalone_examples/cortex directory. ```bash cd standalone_examples/cortex ./cortex activate open_gripper.py ``` ```bash ./cortex activate close_gripper.py ``` ```bash ./cortex activate go_home.py ``` -------------------------------- ### Initialize Isaac Sim Application Source: https://github.com/isaac-sim/isaacsim/blob/main/source/standalone_examples/testing/notebooks/test_ogn_notebook.ipynb Initializes the SimulationApp and creates a new USD stage. Ensure this is called before other simulation operations. ```python from isaacsim import SimulationApp simulation_app = SimulationApp() import omni simulation_app.update() omni.usd.get_context().new_stage() simulation_app.update() ``` -------------------------------- ### Simulate and Query Ant Positions Source: https://context7.com/isaac-sim/isaacsim/llms.txt Demonstrates a basic simulation loop to step the world and query the world poses of ant agents. ```python for i in range(200): my_world.step(render=True) if i % 50 == 0: poses = ants.get_world_poses() print(f"Step {i}: Ant positions:\n{poses[0]}") # positions shape: (4, 3) simulation_app.close() ``` -------------------------------- ### Spawn entities using SpawnEntity service Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Commands to spawn USD models or empty Xforms into the simulation with various configuration options. ```bash ros2 service call /spawn_entity simulation_interfaces/srv/SpawnEntity "{name: 'MyEntity', allow_renaming: false, uri: '/path/to/model.usd'}" ``` ```bash ros2 service call /spawn_entity simulation_interfaces/srv/SpawnEntity "{name: 'PositionedEntity', allow_renaming: false, uri: '/path/to/model.usd', initial_pose: {pose: {position: {x: 1.0, y: 2.0, z: 3.0}, orientation: {w: 1.0, x: 0.0, y: 0.0, z: 0.0}}}}" ``` ```bash ros2 service call /spawn_entity simulation_interfaces/srv/SpawnEntity "{name: 'EmptyXform', allow_renaming: false, uri: ''}" ``` ```bash ros2 service call /spawn_entity simulation_interfaces/srv/SpawnEntity "{name: 'AutoRenamedEntity', allow_renaming: true, uri: '/path/to/model.usd'}" ``` ```bash ros2 service call /spawn_entity simulation_interfaces/srv/SpawnEntity "{name: 'NamespacedEntity', allow_renaming: false, uri: '/path/to/model.usd', entity_namespace: 'robot1'}" ``` -------------------------------- ### Step Simulation by 1 Frame Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Use the StepSimulation service to advance the simulation by a specified number of frames. The simulation must be paused before calling this service. ```bash ros2 service call /step_simulation simulation_interfaces/srv/StepSimulation "{steps: 1}" ``` -------------------------------- ### Send SimulateSteps Action Goal Source: https://github.com/isaac-sim/isaacsim/blob/main/source/extensions/isaacsim.ros2.sim_control/docs/README.md Use the SimulateSteps action to step the simulation by a specified number of frames. This action provides feedback after each step. ```bash ros2 action send_goal /simulate_steps simulation_interfaces/action/SimulateSteps "{steps: 10}" ```