Some checks failed
nightly / Test against latest dependencies (py3.10) (push) Has been cancelled
nightly / Test against latest dependencies (py3.13) (push) Has been cancelled
tests / tests (3.13, locked) (push) Has been cancelled
tests / tests (3.13, unlocked) (push) Has been cancelled
tests / pyright (3.10) (push) Has been cancelled
tests / lint-format (push) Has been cancelled
tests / tests (3.10, locked) (push) Has been cancelled
tests / tests (3.11, locked) (push) Has been cancelled
tests / tests (3.12, locked) (push) Has been cancelled
tests / pyright (3.11) (push) Has been cancelled
tests / pyright (3.12) (push) Has been cancelled
tests / pyright (3.13) (push) Has been cancelled
tests / ty-check (3.10) (push) Has been cancelled
tests / ty-check (3.11) (push) Has been cancelled
tests / ty-check (3.12) (push) Has been cancelled
tests / ty-check (3.13) (push) Has been cancelled
tests / stubs (push) Has been cancelled
tests / smoke-test (push) Has been cancelled
Docker / check_paths (push) Has been cancelled
docs / build (push) Has been cancelled
Docker / build (push) Has been cancelled
Upstream: https://github.com/michaelgillett/mjlab Upstream-Commit: c19f713c415a699a79d71cd96aa13c3104a05047 Upstream-Branch: main
27 lines
830 B
Python
27 lines
830 B
Python
"""Tests for mjlab.utils.lab_api.math module."""
|
|
|
|
import pytest
|
|
import torch
|
|
from conftest import get_test_device
|
|
|
|
from mjlab.utils.lab_api.math import apply_delta_pose
|
|
|
|
|
|
@pytest.fixture
|
|
def device():
|
|
return get_test_device()
|
|
|
|
|
|
def test_apply_delta_pose_zero_rotation_is_finite_and_identity(device):
|
|
"""Zero rotation delta should return finite values and preserve input pose."""
|
|
source_pos = torch.zeros(2, 3, device=device)
|
|
source_rot = torch.tensor([[1.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]], device=device)
|
|
delta_pose = torch.zeros(2, 6, device=device)
|
|
|
|
target_pos, target_rot = apply_delta_pose(source_pos, source_rot, delta_pose)
|
|
|
|
assert torch.isfinite(target_pos).all()
|
|
assert torch.isfinite(target_rot).all()
|
|
assert torch.allclose(target_pos, source_pos)
|
|
assert torch.allclose(target_rot, source_rot)
|