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 parameterization type to orientation constraints #96

Merged
merged 8 commits into from
Nov 19, 2020

Conversation

JeroenDM
Copy link
Contributor

@JeroenDM JeroenDM commented Nov 1, 2020

As explained and discussed in #89

I think it could be useful to add an extra field to the message for orientation constraints that specifies how the orientation should be parameterized when testing the constraints. Currently, the tolerances are applied to the XYZ Euler angles (intrinsic rotations), but they could be just as well be applied to any three number parameterization.

While working on #2092, I seem to notice that exponential coordinates (rotation angle * rotation axis) performed better for projection-based sampling.

[...], but for planners that don't like Euler angles, it is useful to have this alternative. For example, TrajOpt does not use Euler angles.

I'm almost finished with a corresponding PR that implements this new parameterization. (Edit: the PR) This would look like this:

  if (parameterization_ == Parameterization::XYZ_EULER_ANGLES)
  {
    // original code
    xyz = diff.linear().eulerAngles(0, 1, 2);  // 0,1,2 corresponds to XYZ, the convention used in sampling constraints
    xyz(0) = std::min(fabs(xyz(0)), boost::math::constants::pi<double>() - fabs(xyz(0)));
    xyz(1) = std::min(fabs(xyz(1)), boost::math::constants::pi<double>() - fabs(xyz(1)));
    xyz(2) = std::min(fabs(xyz(2)), boost::math::constants::pi<double>() - fabs(xyz(2)));
  }
  else if (parameterization_ == Parameterization::ROTATION_VECTOR)
  {
   // new code
    Eigen::AngleAxisd aa(diff.linear());
    xyz = aa.axis() * aa.angle();
    xyz(0) = fabs(xyz(0));
    xyz(1) = fabs(xyz(1));
    xyz(2) = fabs(xyz(2));
  }

in moveit_core/kinematics_constraints.

@JeroenDM
Copy link
Contributor Author

JeroenDM commented Nov 2, 2020

@mamoll @v4hn what do you think?

This will bring us a step closer to planning with orientation constraints with the new OMPL planner.

msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
JeroenDM and others added 2 commits November 3, 2020 08:35
Co-authored-by: Felix von Drigalski <FvDrigalski@gmail.com>
Copy link
Member

@AndyZe AndyZe left a comment

Choose a reason for hiding this comment

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

Approved assuming you make the small punctuation change

msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
@JeroenDM
Copy link
Contributor Author

JeroenDM commented Nov 4, 2020

I applied the latest review suggestions. Thank you!

@felixvd I would think squashing is fine for such a small change, but if you want I can clean up the commit history.

Copy link
Contributor

@felixvd felixvd left a comment

Choose a reason for hiding this comment

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

Yes, I'll squash merge after this last comment.

float64 absolute_x_axis_tolerance
float64 absolute_y_axis_tolerance
float64 absolute_z_axis_tolerance

# Defines how the orientation error is calculated
# See absolute axis tolerance below to specify the magnitude.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm good with the content, but shouldn't this new block be moved above the absolute_axis_tolerance entries? This line also assumes they are below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, good catch, I thought I changed it to above... I will fix it. But about the order:

My reasoning was that if you do not care about the parameterization you don't have to read it. I imagined the file was organized with the important (required) features at the top and the optional less common features at the bottom.

But on the other hand, it is maybe better to first mention how the tolerance values are used before allowing you to specify them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@felixvd I changed "below" to "above". I assume users start reading at the top of the file, and they can stop reading if they don't care about which parameterization is used. (For small tolerances, or tolerance on a single axis, this does not matter.)

Is this ok?

Copy link
Contributor

@felixvd felixvd left a comment

Choose a reason for hiding this comment

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

Some nits, but I'm fine with this otherwise. Will merge after last comments and maybe changes from Jeroen.

msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
msg/OrientationConstraint.msg Show resolved Hide resolved
msg/OrientationConstraint.msg Outdated Show resolved Hide resolved
JeroenDM and others added 3 commits November 19, 2020 08:22
Co-authored-by: Felix von Drigalski <FvDrigalski@gmail.com>
Co-authored-by: Felix von Drigalski <FvDrigalski@gmail.com>
@JeroenDM
Copy link
Contributor Author

@felixvd I went through your latest suggestions.

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.

None yet

4 participants