Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3c8340f
Reset the actuator networks by mask in Warp kernels and keep the MLP …
hujc7 Nov 13, 2026
660eeb2
Copy a host env_mask to the actuator collection's device before reset…
hujc7 Nov 13, 2026
1a3ef00
Resample the ray-caster drift from per-environment Warp random states…
hujc7 Nov 13, 2026
a40fdc8
Keep the reset tests to the behavior this change adds
hujc7 Nov 16, 2026
4b9dd92
Reseed the ray-caster drift states on every configure_seed
hujc7 Nov 17, 2026
9ad50a6
Keep the experimental Warp environments on their own random state ker…
hujc7 Nov 17, 2026
09d7e81
Drop the drift resampling kernel tests that the ray-caster reset test…
hujc7 Nov 17, 2026
b1b963f
Keep the Newton ray-caster partial reset test to the replayed mask
hujc7 Nov 17, 2026
1cbb382
Fold the independent drift check into the drift seeding test
hujc7 Nov 17, 2026
61c5ed5
Drop the MLP history address assertions
hujc7 Nov 17, 2026
abd4a77
Mix the ray-caster creation index into the drift seed
hujc7 Nov 17, 2026
e7c807e
Seed each ray caster's drift from its configuration, not its creation…
hujc7 Nov 17, 2026
19701d9
Use the shared RNG seeding kernel in the Warp reorient environment
hujc7 Nov 18, 2026
70c6ef8
Merge remote-tracking branch 'upstream/main' into jichuanh/actuator-n…
hujc7 Nov 23, 2026
6c27eb3
Keep the ActuatorNetMLP history in Warp and run its network with Warp-NN
hujc7 Nov 23, 2026
0ef4971
Load the MLP actuator network from an ONNX file or a TorchScript file
hujc7 Nov 23, 2026
4634d78
Scale and clip the MLP actuator torque in a Warp kernel
hujc7 Nov 23, 2026
b583572
Merge remote-tracking branch 'upstream/main' into jichuanh/actuator-n…
hujc7 Nov 30, 2026
19d9aab
Require warp-nn 0.5.0
hujc7 Nov 30, 2026
6f4030a
Export TorchScript actuator networks for the actuator's batch
hujc7 Nov 30, 2026
d98b83c
Mark ActuatorNetMLP capturable
hujc7 Nov 30, 2026
e5c4d2f
Describe the MLP actuator's ONNX network file in the actuator concepts
hujc7 Nov 30, 2026
3a8360a
Run ActuatorNetLSTM with Warp-NN
hujc7 Nov 30, 2026
5d49b8d
Make the network actuators' Warp views once at construction
hujc7 Nov 30, 2026
83b89b8
Combine the LSTM changelog entry with the network actuators' entry
hujc7 Nov 30, 2026
ec5dc49
Move the network actuators' Warp kernels into actuator_kernels.py
hujc7 Nov 30, 2026
ac3553d
Load network actuators by name and share the DC motor clip
hujc7 Dec 2, 2026
55d930d
Keep the env_mask device check out of ActuatorCollection.reset
hujc7 Dec 2, 2026
e07b99f
Seed ray-caster drift once when the rays initialize
hujc7 Dec 2, 2026
8f2987c
Index network buffers by row and pass the MLP history samples as argu…
hujc7 Dec 2, 2026
b052598
Load network files in the actuators without a callable
hujc7 Dec 2, 2026
beb29c1
Share the network loading in the base and look up LSTM inputs by name
hujc7 Dec 2, 2026
b4175b1
Drop the ONNX converter script and the network name checks
hujc7 Dec 2, 2026
46c853c
Merge remote-tracking branch 'upstream/main' into jichuanh/actuator-n…
hujc7 Dec 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/source/concepts/actuators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ The delay is sampled uniformly from ``[min_delay, max_delay]`` at reset.
for linkages whose effective lever arm changes through their range of motion.

**ActuatorNetMLP / ActuatorNetLSTM.** Learned torque models that use joint-position error and
velocity history and clip output with the DC-motor envelope. ``network_file`` is a TorchScript
checkpoint. See the :mod:`isaaclab.actuators` API reference for configuration details.
velocity history and clip output with the DC-motor envelope. ``network_file`` is an ONNX model, or a
TorchScript checkpoint exported to ONNX when the actuator loads; the network runs with Warp-NN, so it must use
operators that Warp-NN supports. See the :mod:`isaaclab.actuators` API reference for configuration details.

**BamActuatorCfg.** A parameter-identified model of a small voltage-controlled servo, described in
:ref:`actuators-bam`. Unlike the PD models it takes no stiffness or damping: its position loop is
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies = [
"transformers==5.10.4",
"einops",
"warp-lang==1.17.0",
"warp-nn>=0.5.0",
"matplotlib>=3.10.3",
# pillow: floor, not exact — an exact pin below Isaac Sim's prebundled version forces a
# downgrade that deletes the prebundled copy other extensions symlink into (nvbugs 6410989).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Added :func:`~isaaclab.utils.warp.kernels.initialize_rng_state`, which seeds one Warp random number generator
state per environment for kernels that draw per-environment random numbers.
* Added :func:`~isaaclab.utils.io.load_onnx_model`, which reads an ONNX model file, and
:func:`~isaaclab.utils.io.export_torchscript_to_onnx`, which exports a TorchScript module to an ONNX model in memory.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
* Changed :class:`~isaaclab.actuators.ActuatorNetLSTM` and :class:`~isaaclab.actuators.ActuatorNetMLP` to reset by a
Warp kernel when given an environment mask, so a CUDA graph can record the reset.
* Changed :class:`~isaaclab.actuators.ActuatorNetLSTM` and :class:`~isaaclab.actuators.ActuatorNetMLP` to run their
networks with Warp-NN, a new dependency. The network file may be an ONNX model whose inputs and outputs carry the
names the actuator looks up (the LSTM's ``input``, ``h0`` and ``c0``, and ``torque``, ``h1`` and ``c1``; the MLP's
single input and output under any names), or a TorchScript module, which is exported to ONNX when the actuator loads. ``network`` is now the
Warp-NN runtime instead of the TorchScript module. Warp kernels write the network input (for the MLP, after
updating the joint history) and scale the torque and clip it to the DC motor limits; the LSTM's hidden and cell
states carry over in Warp buffers, whose Torch views keep the ``sea_*`` attributes. A Warp graph alone can therefore
record the whole torque computation, and both actuators are now :attr:`~isaaclab.actuators.ActuatorBase.capturable`.
* Changed the network actuators to reject a network that uses an operator Warp-NN does not support, with an error
that names the network file and the operator; Torch ran such networks before. A common case is an LSTM head that
takes its time step by indexing, ``out[:, -1]``, which exports to ``Gather``: take the step with ``out.squeeze(1)``
and save the network again.
* Changed :class:`~isaaclab.actuators.DCMotor` to clip its effort in the Warp kernel that the network actuators use;
its ``applied_effort`` is now a view of a preallocated buffer that every step writes in place.
* Changed the ray-caster drift resampling on reset to draw from per-environment Warp random states, so a reset
recorded in a CUDA graph resamples the drift of the selected environments on every replay. The states are seeded
once, when the sensor initializes, from the environment seed and the sensor's prim path and offset: ray casters on
one prim at different offsets draw different drift, and a sensor draws the same drift in every process with the
same seed. A later ``env.reset(seed=...)`` does not restart the drift sequence. Drift no longer draws from Torch's
generator. The drift ranges are unchanged; the drawn values differ.
Empty file.
143 changes: 142 additions & 1 deletion source/isaaclab/isaaclab/actuators/actuator_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: BSD-3-Clause

"""Warp kernels used by actuator collections."""
"""Warp kernels used by actuators and actuator collections."""

from __future__ import annotations

Expand All @@ -14,6 +14,10 @@

from ..utils.warp.index_kernel import IndexKernelDispatcher

"""
Actuator collection kernels.
"""


@wp.kernel(enable_backward=False)
def write_2d_float_with_indices(
Expand Down Expand Up @@ -144,3 +148,140 @@ def compute_implicit_actuator_batch(
computed_effort[env_id, joint_id] = effort
applied_effort[env_id, joint_id] = clamped_effort
soft_velocity_limit[env_id, joint_id] = velocity_limit[env_id, batch_joint_id]


"""
DC motor and network actuator kernels.
"""


@wp.func
def dc_motor_clip(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is a second copy of DCMotor._clip_effort. Could DCMotor use this function too, so the torque-speed envelope lives in one place?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in ac3553d: DCMotor._clip_effort launches the same dc_motor_clip kernel into a preallocated buffer, so the envelope lives in one place (DCMotor compute also went from ~65 to ~45 µs eager).

effort: wp.float32,
joint_vel: wp.float32,
saturation_effort: wp.float32,
vel_at_effort_lim: wp.float32,
velocity_limit: wp.float32,
effort_limit: wp.float32,
) -> wp.float32:
"""Clip an effort to the DC motor's torque-speed limits (see :class:`~isaaclab.actuators.DCMotor`)."""
vel = wp.min(wp.max(joint_vel, -vel_at_effort_lim), vel_at_effort_lim)
max_effort = wp.min(saturation_effort * (1.0 - vel / velocity_limit), effort_limit)
min_effort = wp.max(saturation_effort * (-1.0 - vel / velocity_limit), -effort_limit)
return wp.min(wp.max(effort, min_effort), max_effort)


@wp.kernel(enable_backward=False)
def clip_dc_motor_effort(
# input
effort: wp.array2d(dtype=wp.float32),
joint_vel: wp.array2d(dtype=wp.float32),
saturation_effort: wp.array2d(dtype=wp.float32),
vel_at_effort_lim: wp.array2d(dtype=wp.float32),
velocity_limit: wp.array2d(dtype=wp.float32),
effort_limit: wp.array2d(dtype=wp.float32),
# output
applied_effort: wp.array2d(dtype=wp.float32),
):
"""Clip the effort of each (env, joint) to the DC motor limits. Launch with ``dim=(num_envs, num_joints)``."""
env_id, joint = wp.tid()
applied_effort[env_id, joint] = dc_motor_clip(
effort[env_id, joint],
joint_vel[env_id, joint],
saturation_effort[env_id, joint],
vel_at_effort_lim[env_id, joint],
velocity_limit[env_id, joint],
effort_limit[env_id, joint],
)


@wp.kernel(enable_backward=False)
def scale_and_clip_torque(
# input
torque: wp.array(dtype=wp.float32),
joint_vel: wp.array2d(dtype=wp.float32),
torque_scale: wp.float32,
saturation_effort: wp.array2d(dtype=wp.float32),
vel_at_effort_lim: wp.array2d(dtype=wp.float32),
velocity_limit: wp.array2d(dtype=wp.float32),
effort_limit: wp.array2d(dtype=wp.float32),
# output
computed_effort: wp.array2d(dtype=wp.float32),
applied_effort: wp.array2d(dtype=wp.float32),
):
"""Scale the network torque of each (env, joint) and clip it to the DC motor limits.

``torque`` holds one value per (env, joint), row-major. Launch with ``dim=(num_envs, num_joints)``.
"""
env_id, joint = wp.tid()
effort = torque[env_id * computed_effort.shape[1] + joint] * torque_scale

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flat index is rebuilt by hand here, but _apply_torque already reshapes torque on the host. Reshaping to (num_envs, num_joints) lets this be torque[env_id, joint]. Same for row = env_id * J + joint in write_lstm_input.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it: the network buffers are one row per (env, joint) by design (the ONNX LSTM has a single batch axis, the MLP starts with a Gemm), so 2-D indexing needed a second view of the same memory. I kept the row index.

computed_effort[env_id, joint] = effort
applied_effort[env_id, joint] = dc_motor_clip(
effort,
joint_vel[env_id, joint],
saturation_effort[env_id, joint],
vel_at_effort_lim[env_id, joint],
velocity_limit[env_id, joint],
effort_limit[env_id, joint],
)


@wp.kernel(enable_backward=False)
def write_lstm_input(
# input
joint_pos_target: wp.array2d(dtype=wp.float32),
joint_pos: wp.array2d(dtype=wp.float32),
joint_vel: wp.array2d(dtype=wp.float32),
# output
network_input: wp.array3d(dtype=wp.float32),
):
"""Write the joint position error and velocity of each (env, joint) as its network input row.

Launch with ``dim=(num_envs, num_joints)``.
"""
env_id, joint = wp.tid()
row = env_id * joint_pos.shape[1] + joint
network_input[row, 0, 0] = joint_pos_target[env_id, joint] - joint_pos[env_id, joint]
network_input[row, 0, 1] = joint_vel[env_id, joint]


@wp.func
def _push_newest(history: wp.array3d(dtype=wp.float32), env_id: int, joint: int, sample: wp.float32):
"""Move the history of one (env, joint) back by one step and write ``sample`` as its newest entry."""
for t in range(history.shape[1] - 1):
k = history.shape[1] - 1 - t
history[env_id, k, joint] = history[env_id, k - 1, joint]
history[env_id, 0, joint] = sample


@wp.kernel(enable_backward=False)
def update_mlp_history(
# input
joint_pos_target: wp.array2d(dtype=wp.float32),
joint_pos: wp.array2d(dtype=wp.float32),
joint_vel: wp.array2d(dtype=wp.float32),
history_indices: wp.array(dtype=wp.int32),
pos_scale: wp.float32,
vel_scale: wp.float32,
pos_first: bool,
# output
joint_pos_error_history: wp.array3d(dtype=wp.float32),
joint_vel_history: wp.array3d(dtype=wp.float32),
network_input: wp.array2d(dtype=wp.float32),
):
"""Record the newest joint position error and velocity, then write the scaled samples the network reads.

Each row of ``network_input`` belongs to one (env, joint): its position errors, then its velocities when
``pos_first``, otherwise the reverse. Launch with ``dim=(num_envs, num_joints)``.
"""
env_id, joint = wp.tid()
_push_newest(joint_pos_error_history, env_id, joint, joint_pos_target[env_id, joint] - joint_pos[env_id, joint])
_push_newest(joint_vel_history, env_id, joint, joint_vel[env_id, joint])
num_samples = history_indices.shape[0]
row = env_id * joint_pos.shape[1] + joint
pos_column = wp.where(pos_first, 0, num_samples)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pos_first and history_indices are fixed at init, but here every thread reads them at runtime. A cached kernel factory with wp.static, like make_masked_fill, would bake in the column offsets and the index list.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a cached wp.static kernel per (input_idx, input_order); the Go1 MLP graph replay stayed at 65.5 µs, so I kept the runtime arguments.

vel_column = num_samples - pos_column
for i in range(num_samples):
index = history_indices[i]
network_input[row, pos_column + i] = pos_scale * joint_pos_error_history[env_id, index, joint]
network_input[row, vel_column + i] = vel_scale * joint_vel_history[env_id, index, joint]
Loading
Loading