Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lie tensor conversion #337

Open
VladimirYugay opened this issue Feb 21, 2024 · 2 comments
Open

Lie tensor conversion #337

VladimirYugay opened this issue Feb 21, 2024 · 2 comments

Comments

@VladimirYugay
Copy link

VladimirYugay commented Feb 21, 2024

Hey there, I run the following test:

twist_a = torch.tensor([1, 2, 3, 4, 5, 6]).float()
twist_b = torch.tensor([1, 2, 4, 4, 5, 6]).float()
twist_c = torch.tensor([1, 2, 3, 4, 5, 8]).float()

the difference between twist a and b is the third coordinate in the "rotation" part of the twist, and the difference between twist a and c is in the 6th coordinate of the "translation" part of the twist.

However, when I call:

pp.LieTensor(twist_a, ltype=pp.se3_type).matrix()
pp.LieTensor(twist_b, ltype=pp.se3_type).matrix()

the difference between matrices is not only in rotation but also in translation.

When I call:

pp.LieTensor(twist_a, ltype=pp.se3_type).matrix()
pp.LieTensor(twist_c, ltype=pp.se3_type).matrix()

the difference between matrices is not only in translation but also in rotation.

I was wondering, why when I convert a twist to a transformation matrix, the rotation and translation components are not independent?

Another question is for quaternions, what is the format that you use? From lietensor.py I see that it's (t, q), but for q what's the order: (qx qy qz qw) or (qw qx qy qz)?

@wang-chen
Copy link
Member

Hi, you called se3 not SE3. You can refer to Log and Exp to see the relation between Lie Algebra and Lie Group. I guess you want Lie Group (SE3).

If you want to covert Euler angles to SO3, you may need euler2SO3.

The documentation for quaternions is here.

Here is a sample code:

import torch, pypose as pp

euler = torch.tensor([4, 5, 6], dtype=torch.float32)
SO3 = pp.euler2SO3(euler)
trans = torch.tensor([1, 2, 3], dtype=torch.float32)
SE3 = pp.SE3(torch.cat([trans, SO3]))
print(SE3)
SE3Type LieTensor:
LieTensor([ 1.0000,  2.0000,  3.0000,  0.7563,  0.1438,  0.5858, -0.2533])

@wang-chen
Copy link
Member

The short answer is that the rotation and translation are independent in the representation of Lie Group, and look not independent in Lie Algebra because their relationship is (y is Lie Group)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants