Unverified Commit 054974bf authored by Salar's avatar Salar Committed by GitHub

Fixes bugs in math operation in `omni.isaac.orbit.utils.math` (#55)

* dealing with negative w component in quat
* fix bug on subtract_fram_transform by applying the rotation
* update version and changelog
parent d6a4bc5d
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.2.7"
version = "0.2.8"
# Description
title = "ORBIT framework for Robot Learning"
......
Changelog
---------
0.2.8 (2023-04-10)
~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixed bugs in :meth:`axis_angle_from_quat` in the ``omni.isaac.orbit.core.utils.math`` to handle quaternion with negative w component.
* Fixed bugs in :meth:`subtract_frame_transforms` in the ``omni.isaac.orbit.core.utils.math`` by adding the missing final rotation.
0.2.7 (2023-04-07)
Fixed
......
......@@ -329,7 +329,7 @@ def axis_angle_from_quat(quat: torch.Tensor, eps: float = 1.0e-6) -> torch.Tenso
# Thus, axis-angle is [q_x, q_y, q_z] / (sin(theta/2) / theta)
# When theta = 0, (sin(theta/2) / theta) is undefined
# However, as theta --> 0, we can use the Taylor approximation 1/2 - theta^2 / 48
quat = quat * (1.0 - 2. * (quat[..., 0:1] < 0.0))
mag = torch.linalg.norm(quat[..., 1:], dim=1)
half_angle = torch.atan2(mag, quat[..., 0])
angle = 2.0 * half_angle
......@@ -398,9 +398,10 @@ def subtract_frame_transforms(
frame 2 w.r.t. frame 1.
"""
# compute orientation
q12 = quat_mul(quat_inv(q01), q02)
q10 = quat_inv(q01)
q12 = quat_mul(q10, q02)
# compute translation
t12 = t02 - t01
t12 = quat_apply(q10, t02 - t01)
return t12, q12
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment