Skip to content

Commit 8ac3ae3

Browse files
authored
Re-expose warp.torch for cuRobo IK reachability (#1543)
Fix the cuRobo reachability check, which crashes with `warp-lang` 1.17. Add a test that builds the real cuRobo solver, so CI catches this. ## Why this change? The Isaac Lab 3.0 update (#1481) pinned `warp-lang==1.17.0`. Since then, building `CuroboIKSolver` fails: ``` AttributeError: module 'warp' has no attribute 'torch' ``` Warp removed `warp.torch` in 1.13, but cuRobo still calls `wp.torch.device_from_torch`. So every run with cuRobo reachability validation fails during placement. Isaac Lab has a shim for this in `isaaclab_mimic`. CI missed it because it does not include a test involving starting Curobo IK solver. ## What changes? - Add `add_warp_torch_`warp.torch` the same way Isaac Lab Mimic's init__` calls it - Add TODO for removal once Curobo bumps. - Add `test_ik_solver_eal Droid solver on GPU and checks one reachabIt runs in the existing `curobo_deps` ## Validation Ran in the cuRobo image (`./docker/run_docker.sh -c`) rebuilt from `main` at f8c3e78, with the OpenPI pi05 DROID server for our example workflow cmds. --------- Signed-off-by: Xinjie Yao <xyao@nvidia.com>
1 parent f7a6107 commit 8ac3ae3

4 files changed

Lines changed: 112 additions & 0 deletions

File tree

‎isaaclab_arena_curobo/ik_solver.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from isaaclab_arena_curobo.embodiment_curobo_registry import get_embodiment_curobo_cfg
2222
from isaaclab_arena_curobo.utils.ik_solver_utils import AABBCollisionCuboid, world_config_from_cuboids
2323
from isaaclab_arena_curobo.utils.robot_cfg_utils import load_patched_robot_yaml
24+
from isaaclab_arena_curobo.utils.warp_compat import add_warp_torch_namespace
2425

2526

2627
class CuroboIKSolver:
@@ -84,6 +85,9 @@ def __init__(
8485
# Start with an empty collision world; update_world() fills it per layout.
8586
world_cfg = WorldConfig(cuboid=[])
8687

88+
# TODO(xinjieyao, 2026/10/27): Remove the shim once the cuRobo commit pin is bumped to one that uses
89+
# the top-level wp.* API.
90+
add_warp_torch_namespace()
8791
ik_config = IKSolverConfig.load_from_robot_config(
8892
self.robot_cfg,
8993
world_cfg,

‎isaaclab_arena_curobo/tests/test_curobo_deps.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"isaaclab_arena_curobo.utils.frame_utils",
2929
"isaaclab_arena_curobo.utils.ik_solver_utils",
3030
"isaaclab_arena_curobo.utils.robot_cfg_utils",
31+
"isaaclab_arena_curobo.utils.warp_compat",
3132
"isaaclab_arena_curobo.ik_solver",
3233
"isaaclab_arena_curobo.ik_reachability_validator",
3334
]
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
2+
# All rights reserved.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
"""End-to-end CuroboIKSolver tests against the real cuRobo install, on GPU.
7+
8+
The other cuRobo tests mock the solver or bypass its ``__init__``, so they cannot catch breakage in cuRobo's own
9+
solver build (e.g. its collision checker calling a warp API that the pinned warp-lang no longer has). These build
10+
the real Droid solver sim-free, as ``ReachabilityValidator`` does, and solve one batch.
11+
"""
12+
13+
from __future__ import annotations
14+
15+
import pytest
16+
17+
pytestmark = pytest.mark.curobo_deps
18+
19+
20+
@pytest.fixture(scope="module")
21+
def droid_solver():
22+
"""Real cuRobo IK solver for the Droid embodiment, built once per module."""
23+
from isaaclab_arena_curobo.embodiment_curobo_registry import get_curobo_cfg_by_name
24+
from isaaclab_arena_curobo.ik_solver import CuroboIKSolver
25+
26+
return CuroboIKSolver(get_curobo_cfg_by_name("droid"), num_seeds=8)
27+
28+
29+
def _retract_ee_pose(solver):
30+
"""End-effector pose of the solver's retract configuration, as a ``(1, 4, 4)`` transform in the robot base frame."""
31+
import isaaclab.utils.math as math_utils
32+
33+
state = solver.ik_solver.fk(solver.ik_solver.get_retract_config().view(1, -1))
34+
q_B_E_xyzw = math_utils.convert_quat(state.ee_quaternion, to="xyzw")
35+
return math_utils.make_pose(state.ee_position, math_utils.matrix_from_quat(q_B_E_xyzw))
36+
37+
38+
def test_warp_torch_namespace_forwards_to_top_level_warp():
39+
"""``warp.torch`` exposes the top-level warp torch interop functions cuRobo calls."""
40+
import warp as wp
41+
42+
from isaaclab_arena_curobo.utils.warp_compat import add_warp_torch_namespace
43+
44+
add_warp_torch_namespace()
45+
add_warp_torch_namespace() # idempotent
46+
assert wp.torch.device_from_torch is wp.device_from_torch
47+
48+
49+
def test_solver_reaches_its_own_retract_pose(droid_solver):
50+
"""IK on the forward-kinematics pose of the retract configuration converges."""
51+
from isaaclab_arena_curobo.utils.ik_solver_utils import solve_ik_feasibility
52+
53+
result = solve_ik_feasibility(droid_solver, _retract_ee_pose(droid_solver))
54+
assert result.feasible.tolist() == [True]
55+
56+
57+
def test_solver_rejects_a_pose_out_of_reach(droid_solver):
58+
"""IK on a pose 5 m beyond the retract pose does not converge."""
59+
from isaaclab_arena_curobo.utils.ik_solver_utils import solve_ik_feasibility
60+
61+
T_B_E = _retract_ee_pose(droid_solver)
62+
T_B_E[:, 0, 3] += 5.0
63+
result = solve_ik_feasibility(droid_solver, T_B_E)
64+
assert result.feasible.tolist() == [False]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
2+
# All rights reserved.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
"""Warp compatibility shim for cuRobo."""
7+
8+
from __future__ import annotations
9+
10+
import sys
11+
import types
12+
13+
import warp as wp
14+
15+
# Torch interop functions that warp-lang 1.13 moved from ``warp.torch`` to the top-level ``warp`` namespace.
16+
_WARP_TORCH_FUNCTION_NAMES = (
17+
"from_torch",
18+
"to_torch",
19+
"device_from_torch",
20+
"device_to_torch",
21+
"dtype_from_torch",
22+
"dtype_to_torch",
23+
"stream_from_torch",
24+
"stream_to_torch",
25+
)
26+
27+
28+
def add_warp_torch_namespace() -> None:
29+
"""Re-expose ``warp.torch`` as a module forwarding to the top-level ``warp`` torch interop functions.
30+
31+
warp-lang 1.13 dropped the ``warp.torch`` submodule, but cuRobo still calls ``wp.torch.device_from_torch``
32+
when it builds its mesh collision checker. Call this before constructing a cuRobo solver. Idempotent, and a
33+
no-op when ``warp.torch`` already exists. Mirrors Isaac Lab Mimic's shim; remove once the cuRobo pin uses
34+
the top-level ``wp.*`` API.
35+
"""
36+
if hasattr(wp, "torch"):
37+
return
38+
warp_torch = types.ModuleType("warp.torch")
39+
for name in _WARP_TORCH_FUNCTION_NAMES:
40+
if hasattr(wp, name):
41+
setattr(warp_torch, name, getattr(wp, name))
42+
wp.torch = warp_torch
43+
sys.modules["warp.torch"] = warp_torch

0 commit comments

Comments
 (0)