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

Add slerp and override getattr method #7

Merged
merged 6 commits into from
Mar 6, 2023
Merged

Add slerp and override getattr method #7

merged 6 commits into from
Mar 6, 2023

Conversation

Giulero
Copy link
Collaborator

@Giulero Giulero commented Mar 3, 2023

This PR introduces the slerp method.
See the example slerp_so3 to check how it works.

Also, I introduced a small modification that would allow passing directly Quaternion objects to casadi methods without accessing the quaternion coefficients with .coeffs():

    def __getattr__(self, attr):
        return getattr(self.xyzw, attr)

This modification should give to the Quaternion class methods from the underlying type that is used to build a Quaternion instance.

For example, before:

opti.subject_to(quat[k + 1] == (rotation_SO3[k+1]).as_quat().coeffs())
# or
opti.subject_to(quat[k + 1] == (quaternion_obj[k+1]).coeffs())

Now:

opti.subject_to(quat[k + 1] == (rotation_SO3[k+1]).as_quat())
# or
opti.subject_to(quat[k + 1] == (quaternion_obj[k]))

This modification shouldn't break the previous code since the .coeffs() method is still accessible.

A lot of doc is still missing! I'll add it in a different PR.

@Giulero Giulero self-assigned this Mar 3, 2023
@Giulero Giulero requested a review from diegoferigo March 3, 2023 10:10
@Giulero
Copy link
Collaborator Author

Giulero commented Mar 6, 2023

Thanks @FabioBergonti !

@Giulero Giulero merged commit a3a1d9b into main Mar 6, 2023
@diegoferigo
Copy link
Member

@Giulero sorry for the late feedback, it looks good to me. Is there any reason why you removed the quaternion product method? I don't think I'm using it, but it might be useful to others.

@Giulero
Copy link
Collaborator Author

Giulero commented Mar 6, 2023

Is there any reason why you removed the quaternion product method? I don't think I'm using it, but it might be useful to others.

Actually, it was an old duplicate in SO3 class.
The quaternion product is in the Quaternion class :)

@Giulero Giulero deleted the slerp branch March 6, 2023 11:12
@diegoferigo
Copy link
Member

Is there any reason why you removed the quaternion product method? I don't think I'm using it, but it might be useful to others.

Actually, it was an old duplicate in SO3 class. The quaternion product is in the Quaternion class :)

Ow ok it makes sense! Thanks for the detail 😉

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

Successfully merging this pull request may close these issues.

3 participants