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
10 changes: 10 additions & 0 deletions source/isaaclab_newton/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changelog
---------


0.5.6 (2026-03-10)
~~~~~~~~~~~~~~~~~~

Expand All @@ -12,6 +13,15 @@ Fixed
passed ``body_com_pose_b`` (``wp.transformf``) instead of ``body_com_pos_b``
(``wp.vec3f``) to the underlying warp kernels.

* Fixed :attr:`~isaaclab_newton.assets.ArticulationData.body_inertia`,
:attr:`~isaaclab_newton.assets.RigidObjectData.body_inertia`, and
:attr:`~isaaclab_newton.assets.RigidObjectCollectionData.body_inertia`
returning raw ``mat33f`` arrays instead of ``(N, B, 9)`` float32. The
previous ptr-based reshape assumed ``float32`` with ``ndim == 4``, but
Newton returns ``mat33f`` dtype with ``ndim == 2``. Fixed the pointer
aliasing to correctly reinterpret each 36-byte ``mat33f`` element as 9
contiguous ``float32`` values.


0.5.5 (2026-03-10)
~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,23 +1231,19 @@ def _create_simulation_bindings(self) -> None:
if self._sim_bind_body_com_vel_w is not None:
self._sim_bind_body_com_vel_w = self._sim_bind_body_com_vel_w[:, 0]
self._sim_bind_body_mass = self._root_view.get_attribute("body_mass", SimulationManager.get_model())[:, 0]
# Newton stores body_inertia as (N, B, 3, 3) float32 (row-major 3x3 matrix per body).
# Reinterpret as (N, B, 9) float32 so the public interface matches the documented shape and
# so that the write_body_inertia_to_buffer_* kernels (which expect wp.array3d) receive a 3D array.
# The 9 elements of each 3x3 row-major matrix are contiguous in memory, so we keep the same
# pointer and outer strides but collapse the two trailing dimensions into one.
# Newton stores body_inertia as (N, 1, B) mat33f — the [:, 0] removes the padding dim
# giving (N, B) mat33f. Reinterpret as (N, B, 9) float32 via pointer aliasing.
# Each mat33f element is 9 contiguous float32 values (36 bytes), so the inner stride is 4.
# The slice may be non-contiguous in the outer dims, so we preserve those strides.
_body_inertia_raw = self._root_view.get_attribute("body_inertia", SimulationManager.get_model())[:, 0]
if _body_inertia_raw.ptr is not None and _body_inertia_raw.ndim == 4:
self._sim_bind_body_inertia = wp.array(
ptr=_body_inertia_raw.ptr,
dtype=wp.float32,
shape=(_body_inertia_raw.shape[0], _body_inertia_raw.shape[1], 9),
strides=(_body_inertia_raw.strides[0], _body_inertia_raw.strides[1], _body_inertia_raw.strides[3]),
device=_body_inertia_raw.device,
copy=False,
)
else:
self._sim_bind_body_inertia = _body_inertia_raw
self._sim_bind_body_inertia = wp.array(
ptr=_body_inertia_raw.ptr,
dtype=wp.float32,
shape=(self._num_instances, self._num_bodies, 9),
strides=(_body_inertia_raw.strides[0], _body_inertia_raw.strides[1], 4),
device=_body_inertia_raw.device,
copy=False,
)
self._sim_bind_body_external_wrench = self._root_view.get_attribute("body_f", SimulationManager.get_state_0())[
:, 0
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,18 +719,19 @@ def _create_simulation_bindings(self) -> None:
self._sim_bind_body_link_pose_w = self._root_view.get_link_transforms(SimulationManager.get_state_0())[:, 0]
self._sim_bind_body_com_vel_w = self._root_view.get_link_velocities(SimulationManager.get_state_0())[:, 0]
self._sim_bind_body_mass = self._root_view.get_attribute("body_mass", SimulationManager.get_model())[:, 0]
_inertia_mat33 = self._root_view.get_attribute("body_inertia", SimulationManager.get_model())[:, 0]
if _inertia_mat33.ptr is not None and _inertia_mat33.ndim == 4:
self._sim_bind_body_inertia = wp.array(
ptr=_inertia_mat33.ptr,
dtype=wp.float32,
shape=(_inertia_mat33.shape[0], _inertia_mat33.shape[1], 9),
strides=(_inertia_mat33.strides[0], _inertia_mat33.strides[1], _inertia_mat33.strides[3]),
device=_inertia_mat33.device,
copy=False,
)
else:
self._sim_bind_body_inertia = _inertia_mat33
# Newton stores body_inertia as (N, 1, 1) mat33f — the [:, 0] removes the padding dim
# giving (N, 1) mat33f. Reinterpret as (N, 1, 9) float32 via pointer aliasing.
# Each mat33f element is 9 contiguous float32 values (36 bytes), so the inner stride is 4.
# The slice may be non-contiguous in the outer dims, so we preserve those strides.
_body_inertia_raw = self._root_view.get_attribute("body_inertia", SimulationManager.get_model())[:, 0]
self._sim_bind_body_inertia = wp.array(
ptr=_body_inertia_raw.ptr,
dtype=wp.float32,
shape=(self._num_instances, 1, 9),
strides=(_body_inertia_raw.strides[0], _body_inertia_raw.strides[1], 4),
device=_body_inertia_raw.device,
copy=False,
)
self._sim_bind_body_external_wrench = self._root_view.get_attribute("body_f", SimulationManager.get_state_0())[
:, 0
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,18 @@ def _create_simulation_bindings(self) -> None:
self._sim_bind_body_external_wrench = self._root_view.get_attribute("body_f", state_0)[:, :, 0]
# -- Body mass: (num_envs, num_bodies, 1) float32 → squeeze to (num_envs, num_bodies)
self._sim_bind_body_mass = self._root_view.get_attribute("body_mass", model)[:, :, 0]
# -- Body inertia: (num_envs, num_bodies, 1) mat33f → squeeze, clone to contiguous, convert to float32
inertia_mat33 = self._root_view.get_attribute("body_inertia", model)[:, :, 0]
self._body_inertia = wp.clone(inertia_mat33).view(wp.float32).reshape((self.num_instances, self.num_bodies, 9))
# -- Body inertia: (num_envs, num_bodies, 1) mat33f → squeeze, reinterpret as (N, B, 9) float32.
# Each mat33f element is 9 contiguous float32 values (36 bytes), so the inner stride is 4.
# The slice may be non-contiguous in the outer dims, so we preserve those strides.
_body_inertia_raw = self._root_view.get_attribute("body_inertia", model)[:, :, 0]
self._body_inertia = wp.array(
ptr=_body_inertia_raw.ptr,
dtype=wp.float32,
shape=(self.num_instances, self.num_bodies, 9),
strides=(_body_inertia_raw.strides[0], _body_inertia_raw.strides[1], 4),
device=_body_inertia_raw.device,
copy=False,
)

def _create_buffers(self) -> None:
"""Create buffers for computing and caching derived quantities."""
Expand Down
Loading