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

Unify pose; Support multi-shape Physx components in SapienPlanningWorld conversion #81

Merged
merged 5 commits into from
Apr 12, 2024

Conversation

KolinGuo
Copy link
Member

@KolinGuo KolinGuo commented Apr 11, 2024

  • Added mplib.Pose similar to sapien.Pose but uses float64 instead.
  • Enabled implicit conversions from sapien.Pose and 4x4 np.ndarray transformation matrix to mplib.Pose
    • This means that you can pass in a sapien.Pose/np.ndarray to any method that requires a mplib.Pose and implicit conversions will jump in so there's no need to call mplib.Pose() constructor explicitly. (Maybe add tests for these as well?)
    • Although, pyright's type checking will give error, which is expected and cannot be handled on MPlib side imo.

@Lexseal Please review this first and make a separate pull request for updating all examples/tests.
Support for Halfspace is not added here. It will have a separate pull request.

This struct is intended to be used only for interfacing with Python.
Internally, Pose is converted to and stored as Eigen::Isometry3 which is
used by all computations.
@KolinGuo KolinGuo linked an issue Apr 11, 2024 that may be closed by this pull request
@KolinGuo KolinGuo requested a review from Lexseal April 11, 2024 08:17
Copy link
Collaborator

@Lexseal Lexseal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I didn't think it would be such a big effort again. Two things I was wondering

  1. Floating point error accumulation can de-unitize the quaternion not sure if it will affect result
  2. How come Pinocchio and some other modules are still rocking Isometry? If it was just missed, I can go ahead and unify all of them in my pass.

src/kinematics/kdl/kdl_model.cpp Show resolved Hide resolved
include/mplib/core/articulated_model.h Show resolved Hide resolved

/// @brief Overloading operator * for ``Pose<S> * Pose<S>``
Pose<S> operator*(const Pose<S> &other) const {
return {q * other.p + p, q * other.q};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not super sure if Eigen will keep the resulting quaternion as unit quaternion due to floating point error. This may potentially break your conjugate inverse from above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about that too. But I guessed that it won't matter too much as we are using double instead of float.
You are certainly welcomed to add unit-tests for this.

include/mplib/utils/pose.h Show resolved Hide resolved
mplib/planner.py Show resolved Hide resolved
mplib/sapien_utils/conversion.py Show resolved Hide resolved
src/core/attached_body.cpp Show resolved Hide resolved
pybind/utils/pose.cpp Show resolved Hide resolved
@Lexseal
Copy link
Collaborator

Lexseal commented Apr 11, 2024

Meanwhile will fix the tests. Will be busy this afternoon with classes so might get these done later today

@KolinGuo KolinGuo merged commit c134a59 into main Apr 12, 2024
9 checks passed
@KolinGuo KolinGuo deleted the unify_pose branch April 12, 2024 19:58
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.

Add mplib.Pose support
2 participants