Skip to content

Commit db7ddae

Browse files
authored
Stabilize Newton rope environment and teleopoeration (#98)
* fix newton stability * update datasets and teleop tuning * lint * fix newton frame transformer refresh
1 parent 4e7369c commit db7ddae

9 files changed

Lines changed: 74 additions & 14 deletions

File tree

‎autodata_examples/envs/isaac_lab_arena/franka_rope/embodiment.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from isaaclab_arena.utils.pose import Pose
2424
from isaaclab_physx.renderers import IsaacRtxRendererCfg, IsaacRtxRendererGlobalSettingsCfg
2525

26+
from autodata_interfaces.env.isaaclab_diff_ik_body_offset_patch import DifferentialInverseKinematicsActionOffset
27+
2628
from . import mdp
2729

2830
_FRANKA_ROPE_INIT_JOINT_POS: dict[str, float] = {
@@ -157,14 +159,15 @@ def __init__(
157159
arm_mode=arm_mode,
158160
)
159161
self.scene_config.robot.init_state.joint_pos = dict(_FRANKA_ROPE_INIT_JOINT_POS)
162+
self.action_config.arm_action.class_type = DifferentialInverseKinematicsActionOffset
160163
self.observation_config = FrankaRopeObservationsCfg()
161164
self.observation_config.policy.concatenate_terms = concatenate_observation_terms
162165
self.camera_config = FrankaRopeCameraCfg()
163166
self.event_config = FrankaRopeEventsCfg()
164167
self.reward_config = None
165168

166169
def _configure_physics_backend(self, backend: PhysicsBackend) -> None:
167-
"""Apply Newton gravity compensation and mesh contact settings to the Franka."""
170+
"""Apply Newton control, gravity compensation, and mesh contact settings to the Franka."""
168171
if backend is PhysicsBackend.NEWTON:
169172
from isaaclab_newton.renderers import NewtonWarpRendererCfg
170173
from isaaclab_newton.sim.schemas import (
@@ -173,8 +176,13 @@ def _configure_physics_backend(self, backend: PhysicsBackend) -> None:
173176
NewtonSDFCollisionPropertiesCfg,
174177
)
175178

179+
from autodata_interfaces.env.isaaclab_newton_frame_transformer_patch import FrameTransformerResetPatch
180+
176181
from .newton_cfg import spawn_rope_franka_newton
177182

183+
self.scene_config.ee_frame.class_type = FrameTransformerResetPatch
184+
# Limit joint-motion amplification near singularities during sustained contact.
185+
self.action_config.arm_action.controller.ik_params = {"lambda_val": 0.05}
178186
spawn = self.scene_config.robot.spawn
179187
# Match the shared high-PD Franka's PhysX-only disable_gravity setting.
180188
spawn.rigid_props = MujocoRigidBodyCfg(gravcomp=1.0)

‎autodata_examples/envs/isaac_lab_arena/franka_rope/environment.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def _configure_franka_rope_env(env_cfg: Any) -> Any:
4141
env_cfg.sim.dt = 0.01
4242
env_cfg.sim.render_interval = 2
4343
env_cfg.num_rerenders_on_reset = 1
44-
if isinstance(env_cfg.sim.physics, NewtonCfg):
44+
is_newton = isinstance(env_cfg.sim.physics, NewtonCfg)
45+
if is_newton:
4546
from isaaclab_newton.sim.schemas import MujocoCollisionCfg
4647

4748
from .newton_cfg import rope_newton_physics_cfg, spawn_rope_table_newton
@@ -69,8 +70,9 @@ def _configure_franka_rope_env(env_cfg: Any) -> Any:
6970
rot_sensitivity=0.2,
7071
),
7172
"spacemouse": Se3SpaceMouseCfg(
72-
pos_sensitivity=0.2,
73-
rot_sensitivity=0.5,
73+
# Use smaller relative pose targets for precise rope and table contact.
74+
pos_sensitivity=0.1 if is_newton else 0.2,
75+
rot_sensitivity=0.2 if is_newton else 0.5,
7476
),
7577
},
7678
)

‎autodata_examples/envs/isaac_lab_arena/franka_rope/newton_cfg.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def rope_newton_physics_cfg() -> NewtonCfg:
124124
r"/World/envs/env_[^/]+/Robot/.*panda_hand",
125125
r"/World/envs/env_[^/]+/Robot/.*panda_(left|right)finger",
126126
],
127-
mode="lagged",
127+
# Solve rope contact against the rigid solver's updated pose.
128+
mode="staggered",
128129
collide_interval=1,
129130
collision_pipeline=NewtonCollisionPipelineCfg(enable_rigid_soft_full_surface_contact=True),
130131
),
@@ -135,7 +136,8 @@ def rope_newton_physics_cfg() -> NewtonCfg:
135136
# Resolve contacts around the narrow rope, with enough friction to carry it.
136137
soft_contact_ke=1.0e5,
137138
soft_contact_kd=10.0,
138-
soft_contact_mu=10.0,
139+
# Limit tangential forces when the gripper presses into the rope.
140+
soft_contact_mu=3.0,
139141
),
140142
num_substeps=10,
141143
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Temporary Isaac Lab body-offset Jacobian backport for Arena rope SoftMimicGen."""
5+
6+
import torch
7+
8+
from isaaclab.envs.mdp.actions.task_space_actions import DifferentialInverseKinematicsAction
9+
from isaaclab.utils import math as math_utils
10+
11+
12+
# TODO 11/16/2026 @peterd: Patch for override in FrankaRopeIKEmbodiment.
13+
# Remove once Arena's Lab pin includes https://github.com/isaac-sim/IsaacLab/pull/7989 (2f1983ca7247).
14+
class DifferentialInverseKinematicsActionOffset(DifferentialInverseKinematicsAction):
15+
"""Apply the upstream tool-offset correction without changing the Lab installation."""
16+
17+
def _compute_frame_jacobian(self) -> torch.Tensor:
18+
self._jacobian_b[:] = self.jacobian_b
19+
if self.cfg.body_offset is not None:
20+
body_quat_b = math_utils.quat_mul(
21+
math_utils.quat_inv(self._asset.data.root_quat_w.torch),
22+
self._asset.data.body_quat_w.torch[:, self._body_idx],
23+
)
24+
offset_b = math_utils.quat_apply(body_quat_b, self._offset_pos)
25+
self._jacobian_b[:, :3] += torch.linalg.cross(self._jacobian_b[:, 3:], offset_b[:, :, None], dim=1)
26+
# A rigidly attached tool has the same angular velocity in base axes.
27+
return self._jacobian_b
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Temporary Newton frame-sensor refresh fix for Arena rope episode restores."""
5+
6+
import warp as wp
7+
from isaaclab_newton.physics import NewtonManager
8+
from isaaclab_newton.sensors.frame_transformer.frame_transformer import FrameTransformer
9+
10+
11+
# TODO: Remove this file and the override in FrankaRopeIKEmbodiment when Arena's
12+
# Lab pin refreshes native frame transforms on sensor reads after reset/reset_to.
13+
class FrameTransformerResetPatch(FrameTransformer):
14+
"""Read restored poses before the first physics step of an episode."""
15+
16+
def _update_buffers_impl(self, env_mask: wp.array) -> None:
17+
# Lab otherwise only updates the native sensor while stepping physics.
18+
# Refresh from the current state before copying its output into Lab buffers.
19+
sensor = NewtonManager._newton_frame_transform_sensors[self._sensor_index]
20+
sensor.update(NewtonManager.get_state())
21+
super()._update_buffers_impl(env_mask)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6fa2b5db4752242eb91cec522053ad1a040741764dcb71ebab6f3abe80e4992c
3-
size 30514205
2+
oid sha256:ad6f85c1231d1982263f7162f8730346edb47f1ce9794c39288496be5e061a72
3+
size 12422461
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:c56d7d7856b07a7b87255b26ba4a0334dde8e2ce548b88e1215d61798732907a
3-
size 13597900
2+
oid sha256:aa135ed3a8e43472237c37037d73ba7e9023a0d9cf9d64565ee6504449561f53
3+
size 12104320
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:c56d7d7856b07a7b87255b26ba4a0334dde8e2ce548b88e1215d61798732907a
3-
size 13597900
2+
oid sha256:aa135ed3a8e43472237c37037d73ba7e9023a0d9cf9d64565ee6504449561f53
3+
size 12104320
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6fa2b5db4752242eb91cec522053ad1a040741764dcb71ebab6f3abe80e4992c
3-
size 30514205
2+
oid sha256:ad6f85c1231d1982263f7162f8730346edb47f1ce9794c39288496be5e061a72
3+
size 12422461

0 commit comments

Comments
 (0)