Skip to content

Commit cfdb170

Browse files
committed
update dexsuite to latest newton
1 parent 7cfccd6 commit cfdb170

File tree

5 files changed

+56
-33
lines changed

5 files changed

+56
-33
lines changed

source/isaaclab/isaaclab/renderer/newton_warp_renderer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import torch
1010

1111
import warp as wp
12-
from newton.sensors import TiledCameraSensor
12+
from newton.sensors import SensorTiledCamera
1313

1414
from isaaclab.sim._impl.newton_manager import NewtonManager
1515
from isaaclab.utils.math import convert_camera_frame_orientation_convention
@@ -49,7 +49,7 @@ def _convert_raw_rgb_tiled(
4949
This kernel converts it to the tiled format (tiled_height, tiled_width, 4) of uint8.
5050
5151
Args:
52-
raw_buffer: Input raw buffer from TiledCameraSensor, shape (num_worlds, num_cameras, width * height) of uint32
52+
raw_buffer: Input raw buffer from SensorTiledCamera, shape (num_worlds, num_cameras, width * height) of uint32
5353
output_buffer: Output buffer in tiled format (tiled_height, tiled_width, 4) of uint8
5454
image_width: Width of each camera image
5555
image_height: Height of each camera image
@@ -99,7 +99,7 @@ def _convert_raw_depth_tiled(
9999
This kernel converts it to the tiled format (tiled_height, tiled_width, 1) of float32.
100100
101101
Args:
102-
raw_buffer: Input raw buffer from TiledCameraSensor, shape (num_worlds, num_cameras, width * height) of float32
102+
raw_buffer: Input raw buffer from SensorTiledCamera, shape (num_worlds, num_cameras, width * height) of float32
103103
output_buffer: Output buffer in tiled format (tiled_height, tiled_width, 1) of float32
104104
image_width: Width of each camera image
105105
image_height: Height of each camera image
@@ -143,12 +143,12 @@ def initialize(self):
143143
"""Initialize the renderer."""
144144
self._model = NewtonManager.get_model()
145145

146-
self._tiled_camera_sensor = TiledCameraSensor(
146+
self._tiled_camera_sensor = SensorTiledCamera(
147147
model=self._model,
148148
num_cameras=1, # TODO: currently only supports 1 camera per world
149149
width=self._width,
150150
height=self._height,
151-
options=TiledCameraSensor.Options(colors_per_shape=True),
151+
options=SensorTiledCamera.Options(colors_per_shape=True),
152152
)
153153

154154
# Note: camera rays will be computed when we have access to TiledCamera
@@ -180,7 +180,7 @@ def set_camera_rays_from_intrinsics(self, intrinsic_matrices: torch.Tensor):
180180
fov_radians_wp = wp.from_torch(fov_radians_all, dtype=wp.float32)
181181

182182
# Compute camera rays with per-camera FOVs (vectorized)
183-
# TiledCameraSensor.compute_pinhole_camera_rays accepts array of FOVs
183+
# SensorTiledCamera.compute_pinhole_camera_rays accepts array of FOVs
184184
self._camera_rays = self._tiled_camera_sensor.compute_pinhole_camera_rays(fov_radians_wp)
185185

186186
def _initialize_output(self):
@@ -238,7 +238,7 @@ def render(
238238
device=camera_positions_wp.device,
239239
)
240240

241-
# Render using TiledCameraSensor
241+
# Render using SensorTiledCamera
242242
self._tiled_camera_sensor.render(
243243
state=NewtonManager.get_state_0(), # Use current physics state
244244
camera_transforms=camera_transforms,

source/isaaclab/isaaclab/sim/_impl/newton_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import warp as wp
1313
from newton import Axis, Contacts, Control, Model, ModelBuilder, State, eval_fk
1414
from newton.examples import create_collision_pipeline
15-
from newton.sensors import ContactSensor as NewtonContactSensor
15+
from newton.sensors import SensorContact as NewtonContactSensor
1616
from newton.sensors import populate_contacts
1717
from newton.solvers import SolverBase, SolverFeatherstone, SolverMuJoCo, SolverNotifyFlags, SolverXPBD
1818

source/isaaclab_newton/isaaclab_newton/assets/articulation/articulation_data.py

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,17 @@ def joint_pos_limits(self) -> wp.array(dtype=wp.vec2f):
389389
(self._root_view.count, self._root_view.joint_dof_count), dtype=wp.vec2f, device=self.device
390390
)
391391

392-
wp.launch(
393-
make_joint_pos_limits_from_lower_and_upper_limits,
394-
dim=(self._root_view.count, self._root_view.joint_dof_count),
395-
inputs=[
396-
self._sim_bind_joint_pos_limits_lower,
397-
self._sim_bind_joint_pos_limits_upper,
398-
self._joint_pos_limits,
399-
],
400-
device=self.device,
401-
)
392+
if self._root_view.joint_dof_count > 0:
393+
wp.launch(
394+
make_joint_pos_limits_from_lower_and_upper_limits,
395+
dim=(self._root_view.count, self._root_view.joint_dof_count),
396+
inputs=[
397+
self._sim_bind_joint_pos_limits_lower,
398+
self._sim_bind_joint_pos_limits_upper,
399+
self._joint_pos_limits,
400+
],
401+
device=self.device,
402+
)
402403
return self._joint_pos_limits
403404

404405
@property
@@ -927,6 +928,8 @@ def joint_vel(self) -> wp.array(dtype=wp.float32):
927928
@property
928929
def joint_acc(self) -> wp.array(dtype=wp.float32):
929930
"""Joint acceleration of all joints. Shape is (num_instances, num_joints)."""
931+
if self._root_view.joint_dof_count == 0:
932+
return self._joint_acc.data
930933
if self._joint_acc.timestamp < self._sim_timestamp:
931934
# note: we use finite differencing to compute acceleration
932935
wp.launch(
@@ -2239,7 +2242,20 @@ def _create_simulation_bindings(self) -> None:
22392242
"joint_target_vel", NewtonManager.get_control()
22402243
)[:, 0]
22412244
else:
2242-
raise ValueError("Number of joints is not supported.")
2245+
# No joints (e.g., free-floating rigid body) - set bindings to None
2246+
self._sim_bind_joint_pos_limits_lower = None
2247+
self._sim_bind_joint_pos_limits_upper = None
2248+
self._sim_bind_joint_stiffness_sim = None
2249+
self._sim_bind_joint_damping_sim = None
2250+
self._sim_bind_joint_armature = None
2251+
self._sim_bind_joint_friction_coeff = None
2252+
self._sim_bind_joint_vel_limits_sim = None
2253+
self._sim_bind_joint_effort_limits_sim = None
2254+
self._sim_bind_joint_pos = None
2255+
self._sim_bind_joint_vel = None
2256+
self._sim_bind_joint_effort = None
2257+
self._sim_bind_joint_position_target = None
2258+
self._sim_bind_joint_velocity_target = None
22432259

22442260
def _create_buffers(self) -> None:
22452261
"""Create buffers for the root data."""
@@ -2288,8 +2304,12 @@ def _create_buffers(self) -> None:
22882304
self._computed_effort = wp.zeros((n_view, n_dof), dtype=wp.float32, device=self.device)
22892305
self._applied_effort = wp.zeros((n_view, n_dof), dtype=wp.float32, device=self.device)
22902306
# -- joint properties for the actuator models
2291-
self._actuator_stiffness = wp.clone(self._sim_bind_joint_stiffness_sim)
2292-
self._actuator_damping = wp.clone(self._sim_bind_joint_damping_sim)
2307+
if n_dof > 0:
2308+
self._actuator_stiffness = wp.clone(self._sim_bind_joint_stiffness_sim)
2309+
self._actuator_damping = wp.clone(self._sim_bind_joint_damping_sim)
2310+
else:
2311+
self._actuator_stiffness = wp.zeros((n_view, 0), dtype=wp.float32, device=self.device)
2312+
self._actuator_damping = wp.zeros((n_view, 0), dtype=wp.float32, device=self.device)
22932313
# -- other data that are filled based on explicit actuator models
22942314
self._joint_dynamic_friction = wp.zeros((n_view, n_dof), dtype=wp.float32, device=self.device)
22952315
self._joint_viscous_friction = wp.zeros((n_view, n_dof), dtype=wp.float32, device=self.device)
@@ -2299,7 +2319,10 @@ def _create_buffers(self) -> None:
22992319
self._soft_joint_pos_limits = wp.zeros((n_view, n_dof), dtype=wp.vec2f, device=self.device)
23002320

23012321
# Initialize history for finite differencing
2302-
self._previous_joint_vel = wp.clone(self._root_view.get_dof_velocities(NewtonManager.get_state_0()))[:, 0]
2322+
if n_dof > 0:
2323+
self._previous_joint_vel = wp.clone(self._root_view.get_dof_velocities(NewtonManager.get_state_0()))[:, 0]
2324+
else:
2325+
self._previous_joint_vel = wp.zeros((n_view, 0), dtype=wp.float32, device=self.device)
23032326
self._previous_body_com_vel = wp.clone(self._sim_bind_body_com_vel_w)
23042327

23052328
# Initialize the lazy buffers.

source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/dexsuite/config/kuka_allegro/dexsuite_kuka_allegro_vision_env_cfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class WristImageObsCfg(ObsGroup):
171171

172172
@configclass
173173
class KukaAllegroSingleCameraMixinCfg(kuka_allegro_dexsuite.KukaAllegroMixinCfg):
174-
scene = KukaAllegroSingleTiledCameraSceneCfg(num_envs=4096, env_spacing=3, replicate_physics=True)
174+
scene = KukaAllegroSingleTiledCameraSceneCfg(num_envs=4096, env_spacing=0.0, replicate_physics=True)
175175
observations: KukaAllegroSingleCameraObservationsCfg = KukaAllegroSingleCameraObservationsCfg()
176176

177177
def __post_init__(self: kuka_allegro_dexsuite.DexsuiteKukaAllegroLiftEnvCfg):
@@ -181,7 +181,7 @@ def __post_init__(self: kuka_allegro_dexsuite.DexsuiteKukaAllegroLiftEnvCfg):
181181

182182
@configclass
183183
class KukaAllegroDuoCameraMixinCfg(kuka_allegro_dexsuite.KukaAllegroMixinCfg):
184-
scene = KukaAllegroDuoTiledCameraSceneCfg(num_envs=4096, env_spacing=3, replicate_physics=True)
184+
scene = KukaAllegroDuoTiledCameraSceneCfg(num_envs=4096, env_spacing=0.0, replicate_physics=True)
185185
observations: KukaAllegroDuoCameraObservationsCfg = KukaAllegroDuoCameraObservationsCfg()
186186

187187
def __post_init__(self: kuka_allegro_dexsuite.DexsuiteKukaAllegroLiftEnvCfg):

source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/dexsuite/dexsuite_env_cfg.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,14 @@ class EventCfg:
323323
# and gradually introducing full gravity (hard) — the agent learns more smoothly.
324324
# This removes the need for a special "Lift" reward (often required to push the
325325
# agent to counter gravity), which has bonus effect of simplifying reward composition overall.
326-
# variable_gravity = EventTerm(
327-
# func=mdp.randomize_physics_scene_gravity,
328-
# mode="reset",
329-
# params={
330-
# "gravity_distribution_params": ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0]),
331-
# "operation": "abs",
332-
# },
333-
# )
326+
variable_gravity = EventTerm(
327+
func=mdp.randomize_physics_scene_gravity,
328+
mode="reset",
329+
params={
330+
"gravity_distribution_params": ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0]),
331+
"operation": "abs",
332+
},
333+
)
334334

335335

336336
@configclass
@@ -417,7 +417,7 @@ class DexsuiteReorientEnvCfg(ManagerBasedEnvCfg):
417417
rewards: RewardsCfg = RewardsCfg()
418418
terminations: TerminationsCfg = TerminationsCfg()
419419
events: EventCfg = EventCfg()
420-
curriculum: CurriculumCfg | None = None
420+
curriculum: CurriculumCfg | None = CurriculumCfg()
421421

422422
def __post_init__(self):
423423
"""Post initialization."""

0 commit comments

Comments
 (0)