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

usd -> sdf: Read transforms #871

Merged
merged 55 commits into from
Mar 31, 2022
Merged

usd -> sdf: Read transforms #871

merged 55 commits into from
Mar 31, 2022

Conversation

ahcorde
Copy link
Collaborator

@ahcorde ahcorde commented Mar 8, 2022

Signed-off-by: ahcorde ahcorde@gmail.com

🎉 New feature

Summary

These functions allow to read the transform of a prim. It allows to read the tranforms from a prim to its parents and it should stop when the name given to the functions is equal to the name of the parent.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Sorry, something went wrong.

@ahcorde ahcorde requested review from adlarkin and koonpeng March 8, 2022 21:31
@ahcorde ahcorde self-assigned this Mar 8, 2022
@ahcorde ahcorde requested review from azeey and scpeters as code owners March 8, 2022 21:31
@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2022

Codecov Report

Merging #871 (cf28342) into sdf12 (6ecfcc2) will decrease coverage by 0.23%.
The diff coverage is 64.90%.

@@            Coverage Diff             @@
##            sdf12     #871      +/-   ##
==========================================
- Coverage   87.95%   87.72%   -0.24%     
==========================================
  Files         101      102       +1     
  Lines       14756    14906     +150     
==========================================
+ Hits        12979    13076      +97     
- Misses       1777     1830      +53     
Impacted Files Coverage Δ
usd/src/usd_parser/USDTransforms.cc 64.66% <64.66%> (ø)
usd/src/usd_parser/USDData.cc 63.55% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ecfcc2...cf28342. Read the comment docs.

ahcorde added 2 commits March 9, 2022 13:22

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde force-pushed the ahcorde/usd_to_sdf_physics branch from 8955a74 to 3a9b349 Compare March 9, 2022 12:49

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde force-pushed the ahcorde/usd_to_sdf_transforms branch from d09ce09 to 576f9bd Compare March 9, 2022 13:05
ahcorde and others added 7 commits March 9, 2022 19:50

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
…hysics
feedback

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
… ahcorde/usd_to_sdf_transforms
@ahcorde ahcorde force-pushed the ahcorde/usd_to_sdf_transforms branch from c0eaf1d to 866ba4f Compare March 10, 2022 09:37
@ahcorde ahcorde added the usd label Mar 10, 2022
ahcorde and others added 4 commits March 10, 2022 13:39

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
ahcorde added 5 commits March 14, 2022 12:47

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
… ahcorde/usd_to_sdf_transforms

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde
Copy link
Collaborator Author

ahcorde commented Mar 24, 2022

@azeey and @adlarkin I made the requested changes even the rotation one, maybe I will need to open fix in the future or the sdf2usd converter is wrong. Not really sure about this

The only change that is still pending is the one related with the const USDData _usdData. I need to change the signature of FindStage, but this will break ABI, this module was not released yet, maybe I can still change it

@ahcorde ahcorde requested review from azeey and adlarkin March 24, 2022 18:20
@ahcorde
Copy link
Collaborator Author

ahcorde commented Mar 25, 2022

@osrf-jenkins retest this please

@adlarkin
Copy link
Contributor

@koonpeng would you mind taking a look at #871 (comment) and giving some feedback?

adlarkin and others added 10 commits March 27, 2022 00:23

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
…ransforms

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
@adlarkin adlarkin force-pushed the ahcorde/usd_to_sdf_transforms branch from 37c78f1 to da475d4 Compare March 30, 2022 20:10

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
@adlarkin adlarkin mentioned this pull request Mar 30, 2022
7 tasks
@adlarkin
Copy link
Contributor

adlarkin commented Mar 30, 2022

I have reviewed the changes in this PR and have a few change proposals, which I listed in a new PR: #924

cc @ahcorde @azeey

@ahcorde
Copy link
Collaborator Author

ahcorde commented Mar 31, 2022

I have reviewed the changes in this PR and have a few change proposals, which I listed in a new PR: #924

cc @ahcorde @azeey

As I mentioned in this comment #924 (review) The suggestions to this PR #924 are breaking the rotations

The gripper has a wrong rotation

Selection_061

ahcorde and others added 2 commits March 31, 2022 10:30

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Co-authored-by: ahcorde <ahcorde@gmail.com>
Comment on lines 249 to 261
ignition::math::Quaterniond qX, qY, qZ;
ignition::math::Angle angleX(IGN_DTOR(rotationEuler[0]));
ignition::math::Angle angleY(IGN_DTOR(rotationEuler[1]));
ignition::math::Angle angleZ(IGN_DTOR(rotationEuler[2]));
qX = ignition::math::Quaterniond(angleX.Normalized().Radian(), 0, 0);
qY = ignition::math::Quaterniond(0, angleY.Normalized().Radian(), 0);
qZ = ignition::math::Quaterniond(0, 0, angleZ.Normalized().Radian());

if (op == kXFormOpRotateZYX)
{
std::swap(angleX, angleZ);
}
t.SetRotation((qX * qY) * qZ);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since ign-math already does Euler angles, my recommendation would be to use that instead of creating 3 quaternions here. I think this can be simplified as:

// SDFormat/ign-math uses extrinsic XYZ rotations, so it's the same as `rotateXYZ`
ignition::math::Quaterniond rot(IGN_DTOR(rotationEuler[0]), IGN_DTOR(rotationEuler[1]), IGN_DTOR(rotationEuler[2]))
  if (op == kxFormOpRotateZYX){
    rot.Invert();
  }
  t.SetRotation(rot);

See https://graphics.pixar.com/usd/release/api/class_usd_geom_xformable.html#details for USD rotation order

See http://sdformat.org/tutorials?tut=specify_pose&cat=specification& for SDFormat rotation order.

qZ = ignition::math::Quaterniond(0, 0, angleZ.Normalized().Radian());

if (op == kXFormOpRotateZYX)
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

The angles are swapped here, but the angles are not used after this line, so it doesn't affect the end result. See my recommendation above.

Comment on lines +58 to +66
EXPECT_TRUE(ignition::math::equal(
_rotation.value().Roll(),
usdTransforms.Rotation().value().Roll(), 0.1));
EXPECT_TRUE(ignition::math::equal(
_rotation.value().Pitch(),
usdTransforms.Rotation().value().Pitch(), 0.1));
EXPECT_TRUE(ignition::math::equal(
_rotation.value().Yaw(),
usdTransforms.Rotation().value().Yaw(), 0.1));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fine. I would probably lower the tolerance a bit. If you want, you could just do
EXPECT_TRUE(_rotation->Equal(*usdTransforms.Rotation(), tol));

Verified

This commit was signed with the committer’s verified signature.
ahcorde Alejandro Hernández Cordero
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde enabled auto-merge (squash) March 31, 2022 17:08
@ahcorde ahcorde merged commit 7861815 into sdf12 Mar 31, 2022
@ahcorde ahcorde deleted the ahcorde/usd_to_sdf_transforms branch March 31, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants