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

Support for objects which evolve on manifold but do not form group (Unit Sphere manifold, as an example) #260

Open
slovak194 opened this issue Dec 19, 2022 · 2 comments

Comments

@slovak194
Copy link

slovak194 commented Dec 19, 2022

Dear @artivis,

I'm considering extending manif with the Unit Sphere manifold Sn (directions in Rn+1).
If it is compatible with the repository roadmap?

PS1: I see, that I'll have to inherit from lie_group_base.h, but that does not sound right to me.

Best regards,
Alex

@joansola
Copy link
Collaborator

joansola commented Dec 19, 2022

Dear Alex,

Thanks for this suggestion. Before elaborating on it, I think we need a little rationale on what needs to be done, or what can be done. I say this because manif implements Lie theory and S^n are not Lie groups, just manifolds.

So we need to discuss how these S^n would integrate with the rest of manif:

What to do with

  • inverse
  • composition
  • exp / log
  • adjoint

how to frame the manifolds operators:

  • retract / lift --> our plus / minus operators in manif

Could you please comment on these issues?

Thank you /// Joan

@slovak194
Copy link
Author

slovak194 commented Dec 20, 2022

Dear @joansola ,
Thank you for your answer!

manif implements Lie theory and S^n are not Lie groups, just manifolds.

Yes, that is the reason of my question. The name of the repository manif[old] suggests that there might be room for manifolds, but not only Lie groups. There are similar benefits of using manifolds to describe robots' states or observations similar to what we have with lie groups such as correct increments/decrements and invariant preservation.

I'm not sure if it will be correct to inherit from LieGroupBase. This will require the implementation of such methods as inverse, composition, which may not be applicable to manifolds. Maybe the LieGroupBase itself should inherit from the ManifoldBase with a simpler interface, and manifolds inherit from ManifoldBase directly.

Please forgive me for some imperfect definitions.

inverse

May not be applicable. But I'm not sure.

composition

May not be applicable. But I'm not sure.

exp / log

Tangent space (plane for S2) can be defined at each point on a unit sphere. The basis for the tangent vector space can also be uniquely defined at each tangent plane and at the manifold origin (I do not use identity as it will require the composition). let's say the origin unit vector r0 = [1, 0, 0], then the basis at r0 is formed by projecting e_y and e_z components of a global basis onto the plane. Basis rotates together with the unit vector and tangent plane to form a unique tangent space and basis at each point on a sphere if it is rotated by a single shortest rotation (not a composition of rotations) with rotation around x = 0. As far as I can see - each point on a sphere can be reached in such a way while keeping the basis unique. The tangent vector then represents a linear speed of the vector tip and can be exponentiated into the rotation of the unit vector.
image

adjoint

It looks like it is impossible to define Adj for S2 at least if the basis in tangent space is defined as rotating the basis at the origin with a single shortest rotation. But I may be wrong here.

retract / lift --> our plus / minus operators in manif

Right plus can be seen as a rotation of the vector r1 around the axis which is formed by crossing tangent vector v1 with e_x by the angle which is equal to the norm of the v1. We have to go through the SO3Tangent and SO3 here to rotate r1. Something like:

def S3Tangent(yz):
    ex = np.array((1, 0, 0))
    vw = np.array((0, yz[0], yz[1]))
    vw_cross = np.cross(ex, vw)
    axis = vw_cross / np.linalg.norm(vw_cross)
    return mp.SO3Tangent(axis * np.linalg.norm(vw[1:]))

minus and left invariants can be achieved as well having SO3Tangent and SO3 as intermediate, or storage types.

To summarize:
As a naїve approach, we can use SO3 as an object that rotates origin r0 to r1, the first column of the SO3.rotation() as our unit vector r, and the linear speed of the tip of this vector as a vector in tangent space.

Best regards,
Alex

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