From ec4c1d21d33bf5f1fbc3671e40ebfff84db63ed0 Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Mon, 26 Oct 2026 16:16:30 -0600 Subject: [PATCH 01/10] Started work on the #902, .lower function call and "None" checking added --- src/roboticstoolbox/robot/BaseRobot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/roboticstoolbox/robot/BaseRobot.py b/src/roboticstoolbox/robot/BaseRobot.py index 9c2913481..ad7401a7b 100644 --- a/src/roboticstoolbox/robot/BaseRobot.py +++ b/src/roboticstoolbox/robot/BaseRobot.py @@ -887,8 +887,10 @@ def default_backend(self) -> Any: @default_backend.setter def default_backend(self, be: Any) -> None: + if be is not None: + be = str(be).lower() self._default_backend = be - + @classmethod def set_default_backend(cls, be: Any) -> None: """ @@ -903,6 +905,9 @@ def set_default_backend(cls, be: Any) -> None: .. seealso:: :attr:`default_backend` """ + if be is not None: + be = str(be).lower() + cls._class_default_backend = be @property From 278baa2c4ebfcf458d40a5e3d35c06d506e0500c Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Tue, 27 Oct 2026 14:15:49 -0600 Subject: [PATCH 02/10] Work in progress --- pyproject.toml | 2 + src/roboticstoolbox/backends/Connector.py | 17 +- .../backends/IsaacSim/__init__.py | 6 + .../backends/IsaacSim/isaacsim_backend.py | 266 ++++++++++++++++++ .../backends/PyPlot/EllipsePlot.py | 1 - src/roboticstoolbox/backends/__init__.py | 6 +- 6 files changed, 288 insertions(+), 10 deletions(-) create mode 100644 src/roboticstoolbox/backends/IsaacSim/__init__.py create mode 100644 src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py diff --git a/pyproject.toml b/pyproject.toml index b20515098..f5d5f7f35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,8 @@ repository = "https://github.com/petercorke/robotics-toolbox-python" swift = ["swift-sim>=2.0.0", "websockets"] +isaacsim-backend = ["isaacsim[all,extscache]==6.2.0.0"] + collision = ["coal; sys_platform != 'win32'", "trimesh"] qp = ["qpsolvers", "quadprog"] diff --git a/src/roboticstoolbox/backends/Connector.py b/src/roboticstoolbox/backends/Connector.py index f6e810e62..d87850e97 100644 --- a/src/roboticstoolbox/backends/Connector.py +++ b/src/roboticstoolbox/backends/Connector.py @@ -11,17 +11,18 @@ @runtime_checkable class Connector(Protocol): + """ - What RTB needs of a graphical backend + What RTB needs of a graphical backend - A backend is any object that has these methods and flags: it does not have to - inherit from this class. Swift does not, since it does not depend on RTB. - The PyPlot backends inherit from it explicitly, which supplies the default - values of the flags and of :meth:`_add_teach_panel`, and makes a missing - method an error at construction. + A backend is any object that has these methods and flags: it does not have to + inherit from this class. Swift does not, since it does not depend on RTB. + The PyPlot backends inherit from it explicitly, which supplies the default + values of the flags and of :meth:`_add_teach_panel`, and makes a missing + method an error at construction. - The methods take different arguments in different backends, so they are - declared with ``*args, **kwargs``; see the backend for the details. + The methods take different arguments in different backends, so they are + declared with ``*args, **kwargs``; see the backend for the details. """ #: True if the backend supports the interactive teach pendant. diff --git a/src/roboticstoolbox/backends/IsaacSim/__init__.py b/src/roboticstoolbox/backends/IsaacSim/__init__.py new file mode 100644 index 000000000..da228f2a3 --- /dev/null +++ b/src/roboticstoolbox/backends/IsaacSim/__init__.py @@ -0,0 +1,6 @@ +from roboticstoolbox.backends.IsaacSim.isaacsim_backend import ( + IsaacSim, + IsaacSimRobotHandle, +) + +__all__ = ["IsaacSim", "IsaacSimRobotHandle"] diff --git a/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py b/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py new file mode 100644 index 000000000..2116580d5 --- /dev/null +++ b/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py @@ -0,0 +1,266 @@ +from __future__ import annotations + +from copy import deepcopy +from pathlib import Path +from typing import Any +import numpy as np + +from roboticstoolbox.tools.types import ArrayLike, NDArray + +class IsaacSimRobotHandle: + """Handle for one independently configured robot instance in Isaac Sim.""" + + robot: Any + articulation: Any + prim_path: str + joint_names: tuple[str, ...] + joint_indices: NDArray + initial_q: NDArray + + def __init__( + self, + robot: Any, + articulation: Any, + prim_path: str, + joint_names: tuple[str, ...], + joint_indices: NDArray, + q: ArrayLike, + ) -> None: ... + + @property + def q(self) -> NDArray: ... + + @q.setter + def q(self, q: ArrayLike) -> None: ... + + def reset(self) -> None: ... + + +class IsaacSim: + """Isaac Sim 6.2 desktop backend for URDF-backed RTB robots.""" + + _isaacsim_default_config = { + # Disable window creation and the user interface. + # "headless": True, + + # Viewport and generated-image dimensions. + "width": 1280, + "height": 720, + + # Run Isaac Sim with its desktop window and UI visible. + "headless": False, + + # Application-window dimensions, independent of the viewport. + # "window_width": 1440, + # "window_height": 900, + + # Rendering mode: "RaytracedLighting", "PathTracing", + # "RealTimePathTracing", or "MinimalRendering". + # "renderer": "RealTimePathTracing", + + # GPU selection. None uses the default execution GPU. + # "active_gpu": None, + # "physics_gpu": 0, + + # Multi-GPU configuration. + # "multi_gpu": True, + # "max_gpu_count": None, + + # Open an existing USD stage automatically at startup. + # "open_usd": None, + + # Create an empty stage when open_usd is not supplied. + # "create_new_stage": True, + + # Pause rendering until stage assets are fully loaded. + # "sync_loads": True, + + # Anti-aliasing mode: 0 disabled, 1 TAA, 2 FXAA, 3 DLSS, 4 RTXAA. + # "anti_aliasing": 3, + + # Path-tracing quality settings. + # "samples_per_pixel_per_frame": 64, + # "denoiser": True, + # "max_bounces": 3, + + # Exit immediately instead of shutting extensions down sequentially. + # "fast_shutdown": True, + + # Maximum number of CPU threads used by the application. + # "limit_cpu_threads": 32, + + # Additional command-line arguments passed to the Kit process. + # "extra_args": [], + } + + supports_teach : bool = False + supports_ellipse: bool = False + _simulation_app : Any = None + + def __init__(self, app_config: dict[str, Any] | None = None) -> None: + + """Create the Isaac Sim application from the supplied configuration. + + The constructor primarily initializes the Isaac Sim ``SimulationApp`` + instance. ``app_config`` provides application settings such as window + dimensions and headless operation; when it is omitted, the backend's + default desktop configuration is used. + + :param app_config: configuration passed to ``SimulationApp`` + """ + + config = {**self._isaacsim_default_config, **(app_config or {})} + self.cached: dict[str, Any] = { + "app_config": deepcopy(config), + "launch": None, + "robots": [], + "handles": [], + } + self._simulation_app = self._create_simulation_app(config) + self._step_remainder = 0.0 + + @property + def robot_handles(self) -> list[IsaacSimRobotHandle]: + """Robot handles currently active in the Isaac Sim scene.""" + + return self.cached["handles"] + + def launch( + self, + name: str | None = None, + limits: ArrayLike | None = None, + fig: str | None = None, + **kwargs: Any, + ) -> None: + + self.cached["launch"] = { + "name": name, + "limits": deepcopy(limits), + "fig": fig, + "kwargs": deepcopy(kwargs), + } + self._create_scene() + + def add( + self, + robot: Any, + readonly: bool = False, + q: ArrayLike | None = None, + **kwargs: Any, + ) -> IsaacSimRobotHandle: + + cached_robot = { + "robot": robot, + "urdf_path": self._urdf_path(robot), + "readonly": readonly, + "q": deepcopy(q), + "kwargs": deepcopy(kwargs), + } + self.cached["robots"].append(cached_robot) + handle = self._add_cached_robot(cached_robot) + self.cached["handles"].append(handle) + return handle + + def remove(self, handle: IsaacSimRobotHandle) -> None: ... + + def step(self, dt: float = 0.05) -> None: + """Advance Isaac Sim by ``dt`` seconds of simulated time.""" + + if dt < 0: + raise ValueError("dt must be non-negative") + + self._require_launched() + + from isaacsim.core.rendering_manager import RenderingManager + from isaacsim.core.simulation_manager import SimulationManager + + physics_dt = SimulationManager.get_physics_dt() + if physics_dt <= 0: + raise RuntimeError("Isaac Sim physics dt must be positive") + + self._step_remainder += dt + step_count = int((self._step_remainder + 1e-12) / physics_dt) + if step_count == 0: + return + + self._step_remainder -= step_count * physics_dt + SimulationManager.step(steps=step_count) + + if not self.cached["app_config"].get("headless", False): + RenderingManager.render() + + def simulation_step(self, dt: float = 0.05) -> None: + + if self._simulation_app.is_running(): + + self._simulation_app.step() + + self._simulation_app.update() + + def reset(self) -> None: + """Rebuild the scene from the cached launch and URDF robot settings.""" + + self._require_launched() + self._simulation_app.reset_render_settings() + self._step_remainder = 0.0 + self._create_scene() + self.cached["handles"] = [ + self._add_cached_robot(cached_robot) + for cached_robot in self.cached["robots"] + ] + + def restart(self) -> None: + + self.close() + + self.__init__() + + def close(self) -> None: + """Close the running Isaac Sim application and release its reference. + + .. seealso:: + `SimulationApp.close `_ + """ + + if self._simulation_app is not None and not self._simulation_app.is_existing(): + + self._simulation_app.close() + self._simulation_app = None + + def hold(self) -> None: ... + + def _load_runtime(self) -> None: ... + + def _create_simulation_app(self, app_config: dict[str, Any]) -> Any: + from isaacsim import SimulationApp + + return SimulationApp(app_config) + + def _create_scene(self) -> None: + from isaacsim.core.api.objects import DynamicCuboid + from isaacsim.core.api.objects.ground_plane import GroundPlane + from isaacsim.core.api.physics_context import PhysicsContext + + + if self._simulation_app.is_running(): + + PhysicsContext() + GroundPlane(prim_path="/World/groundPlane", size=10, color=np.array([0.5, 0.5, 0.5])) + + return + + def _add_cached_robot( + self, cached_robot: dict[str, Any] + ) -> IsaacSimRobotHandle: ... + + def _urdf_path(self, robot: Any) -> Path: ... + + def _import_urdf(self, urdf_path: Path, prim_path: str) -> Any: ... + + def _create_joint_mapping( + self, robot: Any, articulation: Any + ) -> tuple[tuple[str, ...], NDArray]: ... + + def _next_prim_path(self, robot: Any) -> str: ... + + def _require_launched(self) -> None: ... diff --git a/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py b/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py index e91a866fe..29cbf15a5 100644 --- a/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py +++ b/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py @@ -2,7 +2,6 @@ """ @author Jesse Haviland """ - from __future__ import annotations import warnings diff --git a/src/roboticstoolbox/backends/__init__.py b/src/roboticstoolbox/backends/__init__.py index c92f3dd8c..2590026dd 100644 --- a/src/roboticstoolbox/backends/__init__.py +++ b/src/roboticstoolbox/backends/__init__.py @@ -25,8 +25,12 @@ def load_backend(name: str) -> Connector: """ if name == "swift": from roboticstoolbox.backends.swift import Swift # optional dep + + if name == "isaacsim": + from roboticstoolbox.backends.IsaacSim.isaacsim_backend import IsaacSim + + return IsaacSim() - return Swift() elif name == "pyplot": from roboticstoolbox.backends.PyPlot import PyPlot From 4f7b1f78031c6bfb1878d2089dea2e36d1e823ab Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Tue, 27 Oct 2026 14:18:39 -0600 Subject: [PATCH 03/10] Issue fix --- src/roboticstoolbox/backends/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/roboticstoolbox/backends/__init__.py b/src/roboticstoolbox/backends/__init__.py index 2590026dd..4490979d7 100644 --- a/src/roboticstoolbox/backends/__init__.py +++ b/src/roboticstoolbox/backends/__init__.py @@ -25,7 +25,9 @@ def load_backend(name: str) -> Connector: """ if name == "swift": from roboticstoolbox.backends.swift import Swift # optional dep - + + return Swift() + if name == "isaacsim": from roboticstoolbox.backends.IsaacSim.isaacsim_backend import IsaacSim From c06f4fa8cf55ef328a2d16e658cf7f23f5635730 Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Wed, 28 Oct 2026 14:22:16 -0600 Subject: [PATCH 04/10] Added simple test and initial working draft --- .../backends/IsaacSim/isaacsim_backend.py | 206 +++++++++++++----- src/roboticstoolbox/backends/__init__.py | 2 + tests/test_isaacsim_backend.py | 72 ++++++ 3 files changed, 222 insertions(+), 58 deletions(-) create mode 100644 tests/test_isaacsim_backend.py diff --git a/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py b/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py index 2116580d5..ae4f09f91 100644 --- a/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py +++ b/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py @@ -1,12 +1,16 @@ from __future__ import annotations from copy import deepcopy +from dataclasses import dataclass +import os from pathlib import Path from typing import Any import numpy as np from roboticstoolbox.tools.types import ArrayLike, NDArray + +@dataclass class IsaacSimRobotHandle: """Handle for one independently configured robot instance in Isaac Sim.""" @@ -15,29 +19,63 @@ class IsaacSimRobotHandle: prim_path: str joint_names: tuple[str, ...] joint_indices: NDArray + q: NDArray initial_q: NDArray - - def __init__( - self, - robot: Any, - articulation: Any, - prim_path: str, - joint_names: tuple[str, ...], - joint_indices: NDArray, - q: ArrayLike, - ) -> None: ... - - @property - def q(self) -> NDArray: ... - - @q.setter - def q(self, q: ArrayLike) -> None: ... - - def reset(self) -> None: ... + urdf_path: Path + usd_path: Path class IsaacSim: """Isaac Sim 6.2 desktop backend for URDF-backed RTB robots.""" + + class RobotImporter: + """Import URDF robots and cache their source paths.""" + + def __init__(self) -> None: + self.import_config: Any = None + self.importer: Any = None + self.imported_paths: list[Path] = [] + + def create_robot( + self, cached_robot: dict[str, Any] + ) -> IsaacSimRobotHandle: + """Import a cached URDF robot and return its Isaac Sim handle.""" + + from isaacsim.asset.importer.urdf import ( + URDFImporter, + URDFImporterConfig, + ) + + robot = cached_robot["robot"] + urdf_path = cached_robot["urdf_path"] + resolved_urdf_path = Path(urdf_path).expanduser().resolve() + output_dir = os.path.dirname(resolved_urdf_path) + self.import_config = URDFImporterConfig( + urdf_path=os.fspath(resolved_urdf_path), + usd_path=output_dir, + collision_from_visuals=False, + merge_mesh=False, + ) + self.importer = URDFImporter(self.import_config) + output_path = Path(self.importer.import_urdf()) + self.imported_paths.append(resolved_urdf_path) + + configured_q = cached_robot["q"] + if configured_q is None: + configured_q = getattr(robot, "q", []) + q = np.asarray(configured_q, dtype=float).copy() + + return IsaacSimRobotHandle( + robot=robot, + articulation=None, + prim_path="", + joint_names=(), + joint_indices=np.array([], dtype=int), + q=q.copy(), + initial_q=q.copy(), + urdf_path=resolved_urdf_path, + usd_path=output_path, + ) _isaacsim_default_config = { # Disable window creation and the user interface. @@ -93,12 +131,34 @@ class IsaacSim: # "extra_args": [], } - supports_teach : bool = False + # Isaac Sim does not provide an RTB interactive teach panel in milestone one. + supports_teach: bool = False + + # Isaac Sim does not render RTB velocity or force ellipsoids in milestone one. supports_ellipse: bool = False - _simulation_app : Any = None + + # Running Isaac Sim ``SimulationApp`` instance, created by the backend. + _simulation_app: Any = None + + # Active Isaac Sim world containing the imported robot articulations. + _world: Any = None + + # Kit extension manager used to locate Isaac Sim extensions at runtime. + ext_manager: Any + + # Enabled extension identifier for ``isaacsim.asset.importer.urdf``. + ext_id: str | None + + # Filesystem path containing the enabled URDF importer extension. + extension_path: str | None + + @property + def robot_handles(self) -> list[IsaacSimRobotHandle]: + """Robot handles currently active in the Isaac Sim scene.""" + + return self.cached["handles"] def __init__(self, app_config: dict[str, Any] | None = None) -> None: - """Create the Isaac Sim application from the supplied configuration. The constructor primarily initializes the Isaac Sim ``SimulationApp`` @@ -117,14 +177,9 @@ def __init__(self, app_config: dict[str, Any] | None = None) -> None: "handles": [], } self._simulation_app = self._create_simulation_app(config) + self.robot_importer = self.RobotImporter() self._step_remainder = 0.0 - @property - def robot_handles(self) -> list[IsaacSimRobotHandle]: - """Robot handles currently active in the Isaac Sim scene.""" - - return self.cached["handles"] - def launch( self, name: str | None = None, @@ -148,17 +203,49 @@ def add( q: ArrayLike | None = None, **kwargs: Any, ) -> IsaacSimRobotHandle: - + urdf_path = kwargs.pop("urdf_path", None) + + if urdf_path is None: + urdf_path = self._urdf_path(robot) + cached_robot = { "robot": robot, - "urdf_path": self._urdf_path(robot), + "urdf_path": Path(urdf_path), "readonly": readonly, "q": deepcopy(q), "kwargs": deepcopy(kwargs), } self.cached["robots"].append(cached_robot) - handle = self._add_cached_robot(cached_robot) + handle = self._create_robot_from_config(cached_robot) + + import omni.usd + from isaacsim.core.api.robots import Robot + from isaacsim.core.utils.stage import add_reference_to_stage + + if self._world is None or omni.usd.get_context().get_stage() is None: + raise RuntimeError("Isaac Sim world must be launched before adding a robot") + + robot_index = len(self.cached["handles"]) + robot_name = kwargs.get("name", f"robot_{robot_index}") + robot_prim_path = kwargs.get( + "prim_path", f"/World/Robot_{robot_index}" + ) + add_reference_to_stage( + usd_path=os.fspath(handle.usd_path), + prim_path=robot_prim_path, + ) + isaac_robot = self._world.scene.add( + Robot( + prim_path=robot_prim_path, + name=robot_name, + position=np.array([0.0, 0.0, 0.0]), + orientation=np.array([1.0, 0.0, 0.0, 0.0]), + ) + ) + handle.articulation = isaac_robot + handle.prim_path = robot_prim_path self.cached["handles"].append(handle) + return handle def remove(self, handle: IsaacSimRobotHandle) -> None: ... @@ -205,7 +292,7 @@ def reset(self) -> None: self._step_remainder = 0.0 self._create_scene() self.cached["handles"] = [ - self._add_cached_robot(cached_robot) + self._create_robot_from_config(cached_robot) for cached_robot in self.cached["robots"] ] @@ -227,9 +314,13 @@ def close(self) -> None: self._simulation_app.close() self._simulation_app = None - def hold(self) -> None: ... - def _load_runtime(self) -> None: ... + def _load_runtime_extensions(self) -> None: + import omni.kit + + self.ext_manager = omni.kit.app.get_app().get_extension_manager() + self.ext_id = self.ext_manager.get_enabled_extension_id("isaacsim.asset.importer.urdf") + self.extension_path = self.ext_manager.get_extension_path(self.ext_id) def _create_simulation_app(self, app_config: dict[str, Any]) -> Any: from isaacsim import SimulationApp @@ -237,30 +328,29 @@ def _create_simulation_app(self, app_config: dict[str, Any]) -> Any: return SimulationApp(app_config) def _create_scene(self) -> None: - from isaacsim.core.api.objects import DynamicCuboid - from isaacsim.core.api.objects.ground_plane import GroundPlane - from isaacsim.core.api.physics_context import PhysicsContext - - if self._simulation_app.is_running(): - - PhysicsContext() - GroundPlane(prim_path="/World/groundPlane", size=10, color=np.array([0.5, 0.5, 0.5])) - - return - - def _add_cached_robot( + from isaacsim.core.api import World + from isaacsim.core.api.objects.ground_plane import GroundPlane + + self._world = World() + self._world.scene.add( + GroundPlane( + prim_path="/World/groundPlane", + name="ground_plane", + size=10, + color=np.array([0.5, 0.5, 0.5]), + ) + ) + + def _create_robot_from_config( self, cached_robot: dict[str, Any] - ) -> IsaacSimRobotHandle: ... - - def _urdf_path(self, robot: Any) -> Path: ... - - def _import_urdf(self, urdf_path: Path, prim_path: str) -> Any: ... - - def _create_joint_mapping( - self, robot: Any, articulation: Any - ) -> tuple[tuple[str, ...], NDArray]: ... - - def _next_prim_path(self, robot: Any) -> str: ... - - def _require_launched(self) -> None: ... + ) -> IsaacSimRobotHandle: + return self.robot_importer.create_robot(cached_robot) + + #def hold(self) -> None: ... + #def _urdf_path(self, robot: Any) -> Path: ... + #def _create_joint_mapping( + #self, robot: Any, articulation: Any + #) -> tuple[tuple[str, ...], NDArray]: ... + #def _next_prim_path(self, robot: Any) -> str: ... + #def _require_launched(self) -> None: ... diff --git a/src/roboticstoolbox/backends/__init__.py b/src/roboticstoolbox/backends/__init__.py index 4490979d7..481a29353 100644 --- a/src/roboticstoolbox/backends/__init__.py +++ b/src/roboticstoolbox/backends/__init__.py @@ -2,6 +2,7 @@ def load_backend(name: str) -> Connector: + """ Instantiate a graphical backend by name. @@ -23,6 +24,7 @@ def load_backend(name: str) -> Connector: ValueError If ``name`` is not a known backend. """ + if name == "swift": from roboticstoolbox.backends.swift import Swift # optional dep diff --git a/tests/test_isaacsim_backend.py b/tests/test_isaacsim_backend.py new file mode 100644 index 000000000..95a1a07dd --- /dev/null +++ b/tests/test_isaacsim_backend.py @@ -0,0 +1,72 @@ +"""Manual smoke test for the optional Isaac Sim backend.""" + +import os +from pathlib import Path + +import pytest + + +pytestmark = [ + pytest.mark.slow, + pytest.mark.skipif( + os.environ.get("RTB_RUN_ISAACSIM_TESTS") != "1", + reason="set RTB_RUN_ISAACSIM_TESTS=1 to launch Isaac Sim", + ), +] + + +def test_isaacsim_backend_lifecycle() -> None: + """Create the scene, add a Panda, step, and close Isaac Sim.""" + + isaacsim = pytest.importorskip("isaacsim") + + import roboticstoolbox as rtb + from roboticstoolbox.backends import load_backend + from roboticstoolbox.backends.IsaacSim import ( + IsaacSim, + IsaacSimRobotHandle, + ) + + isaacsim_root = Path(isaacsim.__file__).resolve().parent + urdf_path = ( + isaacsim_root + / "exts" + / "isaacsim.asset.importer.urdf" + / "data" + / "urdf" + / "robots" + / "franka_description" + / "robots" + / "panda_arm.urdf" + ) + assert urdf_path.is_file() + + backend = load_backend("isaacsim") + assert isinstance(backend, IsaacSim) + + try: + backend.launch(name="RTB Isaac Sim smoke test") + + assert backend._simulation_app is not None + assert backend._simulation_app.is_running() + assert backend._world is not None + + panda = rtb.models.URDF.Panda() + handle = backend.add( + panda, + q=panda.qr, + urdf_path=urdf_path, + name="panda", + prim_path="/World/Panda", + ) + + assert isinstance(handle, IsaacSimRobotHandle) + assert handle.robot is panda + assert handle.articulation is not None + assert handle.prim_path == "/World/Panda" + assert handle.urdf_path == urdf_path.resolve() + assert handle in backend.robot_handles + + backend.step(1.0 / 60.0) + finally: + backend.close() From 6ec25d02ff1dcffe890d1af55c18ef21b37b6775 Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Fri, 30 Oct 2026 13:17:31 -0600 Subject: [PATCH 05/10] First test, and application loading --- tests/test_isaacsim_backend.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_isaacsim_backend.py b/tests/test_isaacsim_backend.py index 95a1a07dd..217e8296b 100644 --- a/tests/test_isaacsim_backend.py +++ b/tests/test_isaacsim_backend.py @@ -41,11 +41,13 @@ def test_isaacsim_backend_lifecycle() -> None: ) assert urdf_path.is_file() + print("Starting Isaac Sim backend") backend = load_backend("isaacsim") assert isinstance(backend, IsaacSim) try: backend.launch(name="RTB Isaac Sim smoke test") + print("Isaac Sim scene created") assert backend._simulation_app is not None assert backend._simulation_app.is_running() @@ -59,6 +61,7 @@ def test_isaacsim_backend_lifecycle() -> None: name="panda", prim_path="/World/Panda", ) + print(f"Panda added at {handle.prim_path}") assert isinstance(handle, IsaacSimRobotHandle) assert handle.robot is panda @@ -68,5 +71,7 @@ def test_isaacsim_backend_lifecycle() -> None: assert handle in backend.robot_handles backend.step(1.0 / 60.0) + print("Simulation advanced by one step") finally: + print("Closing Isaac Sim backend") backend.close() From 7a9752f56c155d55eecbf60614af369a323b9799 Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Fri, 30 Oct 2026 13:22:39 -0600 Subject: [PATCH 06/10] Removed comment change from the PR --- src/roboticstoolbox/backends/Connector.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/roboticstoolbox/backends/Connector.py b/src/roboticstoolbox/backends/Connector.py index d87850e97..fba9c966d 100644 --- a/src/roboticstoolbox/backends/Connector.py +++ b/src/roboticstoolbox/backends/Connector.py @@ -13,16 +13,16 @@ class Connector(Protocol): """ - What RTB needs of a graphical backend + What RTB needs of a graphical backend - A backend is any object that has these methods and flags: it does not have to - inherit from this class. Swift does not, since it does not depend on RTB. - The PyPlot backends inherit from it explicitly, which supplies the default - values of the flags and of :meth:`_add_teach_panel`, and makes a missing - method an error at construction. + A backend is any object that has these methods and flags: it does not have to + inherit from this class. Swift does not, since it does not depend on RTB. + The PyPlot backends inherit from it explicitly, which supplies the default + values of the flags and of :meth:`_add_teach_panel`, and makes a missing + method an error at construction. - The methods take different arguments in different backends, so they are - declared with ``*args, **kwargs``; see the backend for the details. + The methods take different arguments in different backends, so they are + declared with ``*args, **kwargs``; see the backend for the details. """ #: True if the backend supports the interactive teach pendant. From 4936df5a1021cca5da0868e35cbcedad732c6074 Mon Sep 17 00:00:00 2001 From: Oleksandr Yermolovych Date: Fri, 30 Oct 2026 13:27:03 -0600 Subject: [PATCH 07/10] Removed comment change --- src/roboticstoolbox/backends/Connector.py | 1 - src/roboticstoolbox/backends/__init__.py | 13 +++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/roboticstoolbox/backends/Connector.py b/src/roboticstoolbox/backends/Connector.py index fba9c966d..f6e810e62 100644 --- a/src/roboticstoolbox/backends/Connector.py +++ b/src/roboticstoolbox/backends/Connector.py @@ -11,7 +11,6 @@ @runtime_checkable class Connector(Protocol): - """ What RTB needs of a graphical backend diff --git a/src/roboticstoolbox/backends/__init__.py b/src/roboticstoolbox/backends/__init__.py index 481a29353..f9f1312b8 100644 --- a/src/roboticstoolbox/backends/__init__.py +++ b/src/roboticstoolbox/backends/__init__.py @@ -2,7 +2,6 @@ def load_backend(name: str) -> Connector: - """ Instantiate a graphical backend by name. @@ -24,17 +23,10 @@ def load_backend(name: str) -> Connector: ValueError If ``name`` is not a known backend. """ - if name == "swift": from roboticstoolbox.backends.swift import Swift # optional dep return Swift() - - if name == "isaacsim": - from roboticstoolbox.backends.IsaacSim.isaacsim_backend import IsaacSim - - return IsaacSim() - elif name == "pyplot": from roboticstoolbox.backends.PyPlot import PyPlot @@ -43,5 +35,10 @@ def load_backend(name: str) -> Connector: from roboticstoolbox.backends.PyPlot import PyPlot2 return PyPlot2() + elif name == "isaacsim": + from roboticstoolbox.backends.IsaacSim.isaacsim_backend import IsaacSim + + return IsaacSim() + else: raise ValueError(f"Unknown graphical backend: {name!r}") From 4656719f2167436ef0f08ef6928a73ac0c7eeedd Mon Sep 17 00:00:00 2001 From: alexyermolovych Date: Fri, 30 Oct 2026 16:47:09 -0600 Subject: [PATCH 08/10] Formatting --- pyproject.toml | 1 - src/roboticstoolbox/backends/PyPlot/EllipsePlot.py | 1 + src/roboticstoolbox/robot/BaseRobot.py | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f5d5f7f35..8f9e26452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,6 @@ repository = "https://github.com/petercorke/robotics-toolbox-python" swift = ["swift-sim>=2.0.0", "websockets"] isaacsim-backend = ["isaacsim[all,extscache]==6.2.0.0"] - collision = ["coal; sys_platform != 'win32'", "trimesh"] qp = ["qpsolvers", "quadprog"] diff --git a/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py b/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py index 29cbf15a5..e91a866fe 100644 --- a/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py +++ b/src/roboticstoolbox/backends/PyPlot/EllipsePlot.py @@ -2,6 +2,7 @@ """ @author Jesse Haviland """ + from __future__ import annotations import warnings diff --git a/src/roboticstoolbox/robot/BaseRobot.py b/src/roboticstoolbox/robot/BaseRobot.py index ad7401a7b..07325fa56 100644 --- a/src/roboticstoolbox/robot/BaseRobot.py +++ b/src/roboticstoolbox/robot/BaseRobot.py @@ -890,7 +890,6 @@ def default_backend(self, be: Any) -> None: if be is not None: be = str(be).lower() self._default_backend = be - @classmethod def set_default_backend(cls, be: Any) -> None: """ @@ -909,7 +908,6 @@ def set_default_backend(cls, be: Any) -> None: be = str(be).lower() cls._class_default_backend = be - @property def gravity(self) -> NDArray: """ From bdacc73e5aee18ae890d867eb6e069924d6ff2fb Mon Sep 17 00:00:00 2001 From: alexyermolovych Date: Fri, 13 Nov 2026 15:48:22 -0700 Subject: [PATCH 09/10] Basic smoke test passed, franka test --- .gitignore | 4 ++ .../backends/IsaacSim/isaacsim_backend.py | 40 ++++++++++++++----- tests/test_isaacsim_backend.py | 4 ++ 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2f59c3da1..51459121a 100644 --- a/.gitignore +++ b/.gitignore @@ -199,3 +199,7 @@ docs/lite/wasm_check/node_modules/ # files written by running docs/notebooks/branched-robot.ipynb docs/notebooks/*.dot docs/notebooks/*.svg + +src/roboticstoolbox/backends/BaseRobot.py +src/roboticstoolbox/backends/Gripper.py +test_run.sh diff --git a/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py b/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py index ae4f09f91..4d8f0b8c9 100644 --- a/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py +++ b/src/roboticstoolbox/backends/IsaacSim/isaacsim_backend.py @@ -122,7 +122,7 @@ def create_robot( # "max_bounces": 3, # Exit immediately instead of shutting extensions down sequentially. - # "fast_shutdown": True, + "fast_shutdown": False, # Maximum number of CPU threads used by the application. # "limit_cpu_threads": 32, @@ -277,12 +277,9 @@ def step(self, dt: float = 0.05) -> None: RenderingManager.render() def simulation_step(self, dt: float = 0.05) -> None: - - if self._simulation_app.is_running(): - - self._simulation_app.step() + """Advance the active Isaac Sim world by ``dt`` seconds.""" - self._simulation_app.update() + self.step(dt) def reset(self) -> None: """Rebuild the scene from the cached launch and URDF robot settings.""" @@ -309,10 +306,11 @@ def close(self) -> None: `SimulationApp.close `_ """ - if self._simulation_app is not None and not self._simulation_app.is_existing(): - - self._simulation_app.close() + if self._simulation_app is not None: + if not self._simulation_app.is_exiting(): + self._simulation_app.close() self._simulation_app = None + self._world = None def _load_runtime_extensions(self) -> None: @@ -347,10 +345,30 @@ def _create_robot_from_config( ) -> IsaacSimRobotHandle: return self.robot_importer.create_robot(cached_robot) + def _urdf_path(self, robot: Any) -> Path: + urdf_filepath = getattr(robot, "urdf_filepath", "") + if not urdf_filepath: + raise ValueError("Isaac Sim requires a URDF-backed robot") + + urdf_path = Path(urdf_filepath).expanduser().resolve() + if not urdf_path.is_file(): + raise FileNotFoundError(f"robot URDF does not exist: {urdf_path}") + if urdf_path.suffix.lower() != ".urdf": + raise ValueError( + "Isaac Sim requires an expanded .urdf file; " + f"received {urdf_path.name!r}" + ) + + return urdf_path + + def _require_launched(self) -> None: + if self._simulation_app is None or not self._simulation_app.is_running(): + raise RuntimeError("Isaac Sim is not running") + if self._world is None: + raise RuntimeError("launch() must be called before using the backend") + #def hold(self) -> None: ... - #def _urdf_path(self, robot: Any) -> Path: ... #def _create_joint_mapping( #self, robot: Any, articulation: Any #) -> tuple[tuple[str, ...], NDArray]: ... #def _next_prim_path(self, robot: Any) -> str: ... - #def _require_launched(self) -> None: ... diff --git a/tests/test_isaacsim_backend.py b/tests/test_isaacsim_backend.py index 217e8296b..9a1603bb9 100644 --- a/tests/test_isaacsim_backend.py +++ b/tests/test_isaacsim_backend.py @@ -72,6 +72,10 @@ def test_isaacsim_backend_lifecycle() -> None: backend.step(1.0 / 60.0) print("Simulation advanced by one step") + except Exception as error: + print(f"Isaac Sim smoke test failed: {error}") + raise + finally: print("Closing Isaac Sim backend") backend.close() From 649db9063614a5bded644f5b3d6a93be121f124a Mon Sep 17 00:00:00 2001 From: alexyermolovych Date: Fri, 13 Nov 2026 16:09:25 -0700 Subject: [PATCH 10/10] Added proper light to the scene --- tests/test_isaacsim_backend.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_isaacsim_backend.py b/tests/test_isaacsim_backend.py index 9a1603bb9..9ec6eb0e3 100644 --- a/tests/test_isaacsim_backend.py +++ b/tests/test_isaacsim_backend.py @@ -2,7 +2,6 @@ import os from pathlib import Path - import pytest @@ -62,6 +61,10 @@ def test_isaacsim_backend_lifecycle() -> None: prim_path="/World/Panda", ) print(f"Panda added at {handle.prim_path}") + from pxr import UsdLux + + light = UsdLux.DistantLight.Define(backend._world.stage, "/World/defaultLight") + light.CreateIntensityAttr(1000.0) assert isinstance(handle, IsaacSimRobotHandle) assert handle.robot is panda @@ -70,8 +73,15 @@ def test_isaacsim_backend_lifecycle() -> None: assert handle.urdf_path == urdf_path.resolve() assert handle in backend.robot_handles - backend.step(1.0 / 60.0) - print("Simulation advanced by one step") + while True: + + backend.step(1.0 / 60.0) + print("Simulation advanced by one step") + + except KeyboardInterrupt as error: + print(f"Isaac Sim has been stopped using CTRL+C: {error}") + raise + except Exception as error: print(f"Isaac Sim smoke test failed: {error}") raise