Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion source/isaaclab_newton/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.2.3"
version = "0.3.0"

# Description
title = "Newton simulation interfaces for IsaacLab core package"
Expand Down
30 changes: 30 additions & 0 deletions source/isaaclab_newton/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
Changelog
---------

0.3.0 (2026-02-25)
~~~~~~~~~~~~~~~~~~

Added
^^^^^

* Added :mod:`isaaclab_newton.test.mock_interfaces` test infrastructure module with
structured mock views, factory functions, and unit tests — mirroring the
``isaaclab_physx`` mock interface pattern:

* :class:`~isaaclab_newton.test.mock_interfaces.views.MockNewtonArticulationView`:
extracted from monolithic ``mock_newton.py`` into its own module with lazy
initialization, individual ``set_mock_*`` methods, ``_noop_setters`` flag,
and numpy-based ``set_random_mock_data()``.

* Factory functions: ``create_mock_articulation_view()``,
``create_mock_quadruped_view()``, ``create_mock_humanoid_view()`` for
convenient test setup.

* Added unit tests for mock interfaces:
``test_mock_articulation_view.py`` and ``test_factories.py``.

Changed
^^^^^^^

* Restructured ``mock_newton.py``: moved ``MockNewtonArticulationView`` to
``views/mock_articulation_view.py`` and removed ``torch`` dependency from
the mock module (replaced with ``numpy`` for random data generation).


0.2.3 (2026-02-27)
~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions source/isaaclab_newton/isaaclab_newton/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

"""Mock interfaces for Newton simulation views.

This module provides mock implementations of Newton simulation components for unit testing
without requiring an actual simulation environment.
"""

from .factories import (
create_mock_articulation_view,
create_mock_humanoid_view,
create_mock_quadruped_view,
)
from .mock_newton import (
MockNewtonContactSensor,
MockNewtonModel,
MockWrenchComposer,
create_mock_newton_manager,
)
from .views import MockNewtonArticulationView

__all__ = [
# Views
"MockNewtonArticulationView",
# Other mocks
"MockNewtonModel",
"MockWrenchComposer",
"MockNewtonContactSensor",
# Factory functions
"create_mock_articulation_view",
"create_mock_quadruped_view",
"create_mock_humanoid_view",
"create_mock_newton_manager",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

"""Factory functions for creating mock Newton views."""

from __future__ import annotations

from .views import MockNewtonArticulationView


def create_mock_articulation_view(
count: int = 1,
num_joints: int = 1,
num_bodies: int = 2,
joint_names: list[str] | None = None,
body_names: list[str] | None = None,
is_fixed_base: bool = False,
device: str = "cpu",
) -> MockNewtonArticulationView:
"""Create a mock Newton articulation view.

Args:
count: Number of articulation instances.
num_joints: Number of degrees of freedom (joints).
num_bodies: Number of bodies (links).
joint_names: Names of the joints. Defaults to auto-generated names.
body_names: Names of the bodies. Defaults to auto-generated names.
is_fixed_base: Whether the articulation has a fixed base.
device: Device for array allocation.

Returns:
A MockNewtonArticulationView instance.
"""
return MockNewtonArticulationView(
num_instances=count,
num_bodies=num_bodies,
num_joints=num_joints,
device=device,
is_fixed_base=is_fixed_base,
joint_names=joint_names,
body_names=body_names,
)


# -- Pre-configured factories --


def create_mock_quadruped_view(
count: int = 1,
device: str = "cpu",
) -> MockNewtonArticulationView:
"""Create a mock articulation view configured for a quadruped robot.

Configuration:
- 12 DOFs (3 per leg x 4 legs: hip, thigh, calf)
- 13 links (base + 3 per leg)
- Floating base

Args:
count: Number of articulation instances.
device: Device for array allocation.

Returns:
A MockNewtonArticulationView configured for quadruped.
"""
joint_names = [
"FL_hip_joint",
"FL_thigh_joint",
"FL_calf_joint",
"FR_hip_joint",
"FR_thigh_joint",
"FR_calf_joint",
"RL_hip_joint",
"RL_thigh_joint",
"RL_calf_joint",
"RR_hip_joint",
"RR_thigh_joint",
"RR_calf_joint",
]
body_names = [
"base",
"FL_hip",
"FL_thigh",
"FL_calf",
"FR_hip",
"FR_thigh",
"FR_calf",
"RL_hip",
"RL_thigh",
"RL_calf",
"RR_hip",
"RR_thigh",
"RR_calf",
]
return MockNewtonArticulationView(
num_instances=count,
num_bodies=13,
num_joints=12,
device=device,
is_fixed_base=False,
joint_names=joint_names,
body_names=body_names,
)


def create_mock_humanoid_view(
count: int = 1,
device: str = "cpu",
) -> MockNewtonArticulationView:
"""Create a mock articulation view configured for a humanoid robot.

Configuration:
- 21 DOFs (typical humanoid configuration)
- 22 links
- Floating base

Args:
count: Number of articulation instances.
device: Device for array allocation.

Returns:
A MockNewtonArticulationView configured for humanoid.
"""
joint_names = [
# Torso
"torso_joint",
# Left arm
"left_shoulder_pitch",
"left_shoulder_roll",
"left_shoulder_yaw",
"left_elbow",
# Right arm
"right_shoulder_pitch",
"right_shoulder_roll",
"right_shoulder_yaw",
"right_elbow",
# Left leg
"left_hip_yaw",
"left_hip_roll",
"left_hip_pitch",
"left_knee",
"left_ankle_pitch",
"left_ankle_roll",
# Right leg
"right_hip_yaw",
"right_hip_roll",
"right_hip_pitch",
"right_knee",
"right_ankle_pitch",
"right_ankle_roll",
]
body_names = [
"pelvis",
"torso",
# Left arm
"left_shoulder",
"left_upper_arm",
"left_lower_arm",
"left_hand",
# Right arm
"right_shoulder",
"right_upper_arm",
"right_lower_arm",
"right_hand",
# Left leg
"left_hip",
"left_upper_leg",
"left_lower_leg",
"left_ankle",
"left_foot",
# Right leg
"right_hip",
"right_upper_leg",
"right_lower_leg",
"right_ankle",
"right_foot",
# Head
"neck",
"head",
]
return MockNewtonArticulationView(
num_instances=count,
num_bodies=22,
num_joints=21,
device=device,
is_fixed_base=False,
joint_names=joint_names,
body_names=body_names,
)
Loading
Loading