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

Added a check to ensure that the shortest path is followed when inter… #14

Merged
merged 2 commits into from
Aug 11, 2022

Conversation

urmahp
Copy link
Contributor

@urmahp urmahp commented Aug 10, 2022

…polating between two orientations

Changed the order of multiplication when calculating the quaternion based velocity and acceleration, since the velocity and acceleration is given in the body-local reference frame.
The math supporting this change, can be found here.

Added unit tests to verify the changes.

If the dot product between two orientations is negative, the sign is flipped on one of them to ensure that we take the shortest path. Without this we could end up interpolating between two identical orientations, but with opposite signs.

This should fix the issue.

To test the following motion will fail on the old version, but work with these changes.
start_pose.position = [-0.63316, -0.50412, 0.07724]
start_pose.orientation = [0.1046779, -0.7045626, 0.1234662, 0.6909343]

end_pose.position = [-0.78590, -0.19334, 0.07724]
end_pose.orientation = [0.0485966, 0.7107247, 0.031284, -0.7010921]

Copy link
Contributor

@stefanscherzinger stefanscherzinger left a comment

Choose a reason for hiding this comment

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

Thanks @urmahp for this fix!

Your contribution is very welcome!
I would recommend, however, that we split this PR into two parts:

  1. Your fix for the sign (see my small suggestions)
  2. The changes of coordinates when handling body-local quaternion velocities and accelerations. While 2. seems reasonable (thanks for the paper reference), I feel we need a separate integration test to cover this use case. I think we currently don't do much velocity or acceleration conditions in the waypoints. But that's exactly where these mechanism show themselves. If you agree, We could take the opportunity to clarify this aspect in a separate PR.

@urmahp
Copy link
Contributor Author

urmahp commented Aug 11, 2022

Thanks @urmahp for this fix!

Your contribution is very welcome! I would recommend, however, that we split this PR into two parts:

1. Your fix for the sign (see my small suggestions)

2. The changes of coordinates when handling _body-local_ quaternion velocities and accelerations. While `2.` seems reasonable (thanks for the paper reference), I feel we need a separate integration test to cover this use case. I think we currently don't do much velocity or acceleration conditions in the waypoints. But that's exactly where these mechanism show themselves. If you agree, We could take the opportunity to clarify this aspect in a separate PR.

Thans for the feedback!

I will split the PR into to two PR's and change the suggestions.

I agree that using conjugate looks cleaner, when flipping the sign, however it wouldn't be correct since only flipping the sign on the complex part would result in a different orientation. You have to flip the sign of the whole quaternion in order to get the same orientation. We could use it to negate the complex part and then negate the real part afterwards.

…polating between two orientations

Addded unit tests to verify the changes.

If the dot product between two orientations is negative, the sign is flipped on one of them to ensure that we take the shortest path. Without this we could end up interpolating between two identical orientations, but with opposite signs.
Co-authored-by: Stefan Scherzinger <[email protected]>
@stefanscherzinger stefanscherzinger merged commit 3f88e21 into UniversalRobots:main Aug 11, 2022
@sebas775
Copy link

how this is integrated to the controller, can you share the steps please, I have an ur3e

Copy link

@sebas775 sebas775 left a comment

Choose a reason for hiding this comment

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

.

@urmahp urmahp deleted the interpolation_quat branch January 9, 2023 09:41
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