Skip to content

fix Eigen::Affine3d for Kinetic#1091

Merged
rhaschke merged 4 commits intomoveit:kinetic-develfrom
ubi-agni:fix-affine
Oct 27, 2018
Merged

fix Eigen::Affine3d for Kinetic#1091
rhaschke merged 4 commits intomoveit:kinetic-develfrom
ubi-agni:fix-affine

Conversation

@rhaschke
Copy link
Copy Markdown
Contributor

@rhaschke rhaschke commented Oct 16, 2018

This attempts to fix #1073, i.e. using Eigen::Affine3d while actually Eigen::Isometry3d is intended.
Instead of changing the actual type throughout the source, I followed @v4hn's suggestion and

  • replaced rotation() -> linear()
  • replaced inverse() -> inverse(Eigen::Isometry) or transpose() if applied to 3x3 rotation matrix only

This implicitly assumes that the linear part of all matrices is orthonormal and doesn't need an SVD to separate the rotation matrix from a (diagonal) scaling matrix.

Changing the type to Eigen::Isometry3d would do these simplifications automatically.
However, for Kinetic we don't want to break API that much.

@simonschmeisser
Copy link
Copy Markdown
Contributor

I find this hard(er) to read, I know what a rotation is but I will have to think a long time to remember what the linear part of a matrix is. It's similar yet not as bad for transpose vs inverse

Would it hurt to only change this for melodic? Or maybe split it into internal and external api cases so that plugins etc still stay compatible? If so I would vote for using Eigen::Isometry3d

@rhaschke
Copy link
Copy Markdown
Contributor Author

@simonschmeisser I don't get your point yet. I think there is no question in applying those changes both in Kinetic and Melodic as there is a severe performance penalty connected with calling Affine3d::rotation() or Affine3d::inverse().

Replacing Eigen::Isometry3d for Eigen::Affine3d applies the more efficient operations automatically when calling rotation() or inverse().

So are you asking to apply this type change in Melodic and keep rotation() and inverse() as is?
I'm definitely open to this. However, this might pose a new issue: Probably it's not possible to assign Isometry3d <- Affine3d, which probably is required when using eigen conversions, isn't it?
If there is consensus on taking this alternative approach, I will target these commits for Kinetic only and provide an alternative PR for Melodic.
@v4hn @davetcoleman Any opinions on that?

@rhaschke
Copy link
Copy Markdown
Contributor Author

rhaschke commented Oct 17, 2018

My concerns are confirmed: #1096 fails when trying to assign Affine3d (as a result of tf2 conversion) to Isometry3d. Tully accepted a while ago a patch to support Isometry in tf1. So we would need to file a similar patch for tf2 as well. Any volunteers?

@rhaschke
Copy link
Copy Markdown
Contributor Author

So we would need to file a similar patch for tf2 as well. Any volunteers?

I will look into this.

@rhaschke
Copy link
Copy Markdown
Contributor Author

rhaschke commented Oct 17, 2018

Just noticed that we will need to switch to Eigen::Isometry in geometric_shapes as well!

@davetcoleman
Copy link
Copy Markdown
Member

I agree I think we should not change kinetic-devel, and do it the better way for melodic-devel using Isometry3d

@rhaschke rhaschke changed the base branch from melodic-devel to kinetic-devel October 20, 2018 16:10
@rhaschke rhaschke changed the title fix Eigen::Affine3d fix Eigen::Affine3d for Kinetic Oct 20, 2018
@rhaschke
Copy link
Copy Markdown
Contributor Author

I rebased and retargeted this PR to Kinetic.

@davetcoleman
Copy link
Copy Markdown
Member

I'm not super comfortable making this kind of change in the kinetic branch, but also do not feel super strongly about it. Would like to hear other's thoughts.

@rhaschke
Copy link
Copy Markdown
Contributor Author

Can you motivate your objections? This is just performance improvement. No API changes.

@rhaschke
Copy link
Copy Markdown
Contributor Author

Rebased, to resolve merge conflicts.

@simonschmeisser
Copy link
Copy Markdown
Contributor

I have not yet compiled and tested this PR but from reading through it does look safe. I still have slight theoretical objections about limiting the amount of changes in a somewhat stable branch but that is more a general issue I guess and not to be discussed here.

I'm really happy this has been fixed in a type-safe manner in melodic and can be bribed by proposed speed improvements (do we have a way to put that into numbers?) for kinetic

@rhaschke
Copy link
Copy Markdown
Contributor Author

Would be indeed interesting to put this in numbers, e.g. performing some random RobotState updates...

Copy link
Copy Markdown
Member

@davetcoleman davetcoleman left a comment

Choose a reason for hiding this comment

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

I reviewed this again more thoroughly and it looks safe

@rhaschke rhaschke mentioned this pull request Oct 24, 2018
@rhaschke rhaschke merged commit 702c46b into moveit:kinetic-devel Oct 27, 2018
@rhaschke rhaschke deleted the fix-affine branch October 27, 2018 04:18
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